Compare commits
12 Commits
d3e99ef12b
...
devel
| Author | SHA1 | Date | |
|---|---|---|---|
|
c8485bc35b
|
|||
|
51709f6ee9
|
|||
|
19f498e091
|
|||
|
6e153d16b1
|
|||
|
b905507bb8
|
|||
|
b69162d79e
|
|||
|
a8c73b569a
|
|||
|
ed1bd120e4
|
|||
|
79b2b6f28f
|
|||
|
fd576bef97
|
|||
|
dbcf8688a5
|
|||
|
e054cd2125
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -269,3 +269,5 @@ collections/ansible_collections/
|
|||||||
.vault_password
|
.vault_password
|
||||||
secrets.yml
|
secrets.yml
|
||||||
.swp
|
.swp
|
||||||
|
# Ignore vscode
|
||||||
|
.vscode/
|
||||||
|
|||||||
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"ansible.python.interpreterPath": "/var/home/ptoal/.virtualenvs/ansible/bin/python"
|
"ansible.python.interpreterPath": "/home/ptoal/.virtualenvs/ansible/bin/python"
|
||||||
}
|
}
|
||||||
@@ -2,22 +2,35 @@
|
|||||||
- name: Deploy BAB Frontend Application
|
- name: Deploy BAB Frontend Application
|
||||||
hosts: bab1.mgmt.toal.ca
|
hosts: bab1.mgmt.toal.ca
|
||||||
become: false
|
become: false
|
||||||
vars:
|
|
||||||
artifact_version: 0.0.2
|
|
||||||
artifact_job: 11
|
|
||||||
artifact_url: https://gitea.toal.ca/oys/bab-app/actions/runs/{{ artifact_job }}/artifacts/build-artifact-{{ artifact_version }}.{{ artifact_job }}
|
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Create temporary directory
|
||||||
|
ansible.builtin.tempfile:
|
||||||
|
state: directory
|
||||||
|
suffix: .deploy
|
||||||
|
register: tempdir
|
||||||
|
|
||||||
- name: Download zip file from url
|
- name: Download zip file from url
|
||||||
ansible.builtin.get_url:
|
ansible.builtin.get_url:
|
||||||
url: "{{ artifact_url }}"
|
url: "{{ artifact_url }}"
|
||||||
dest: /tmp/BABFrontend.zip
|
dest: /{{ tempdir.path }}/BABFrontend.zip
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
|
|
||||||
# Temporary until this drops: https://github.com/ansible/ansible/issues/81092
|
# Temporary until this drops: https://github.com/ansible/ansible/issues/81092
|
||||||
- name: Unzip file to web dir
|
- name: Unzip downloaded file
|
||||||
ansible.builtin.command: unzip -o /tmp/BABFrontend.zip -d /usr/share/nginx/html/
|
ansible.builtin.unarchive:
|
||||||
|
src: "{{ tempdir.path }}/BABFrontend.zip"
|
||||||
|
dest: "{{ tempdir.path }}"
|
||||||
|
list_files: true
|
||||||
|
remote_src: true
|
||||||
|
register: unzip_result
|
||||||
|
|
||||||
- name: Clean up artifact download
|
- name: Extract tar into /usr/share/nginx/html/
|
||||||
|
ansible.builtin.unarchive:
|
||||||
|
src: "{{ unzip_result.dest }}/{{ unzip_result.files[0] }}" # We expect exactly one tar file to be in the artifact.
|
||||||
|
dest: /usr/share/nginx/html/
|
||||||
|
remote_src: true
|
||||||
|
|
||||||
|
- name: Clean up
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: /tmp/BABFrontend.zip
|
path: "{{ tempdir.path }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
|||||||
20
rulebooks/alertmanager_listener.yml
Normal file
20
rulebooks/alertmanager_listener.yml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
- name: Listen for Alertmanager events
|
||||||
|
hosts: all
|
||||||
|
sources:
|
||||||
|
- name: Ansible Alertmanager listener
|
||||||
|
ansible.eda.alertmanager:
|
||||||
|
port: 9100
|
||||||
|
host: 0.0.0.0
|
||||||
|
rules:
|
||||||
|
- name: Run Template
|
||||||
|
condition:
|
||||||
|
all:
|
||||||
|
- event.payload.data.artifact_url is defined
|
||||||
|
action:
|
||||||
|
run_job_template:
|
||||||
|
name: bab-deploy-application
|
||||||
|
organization: OYS
|
||||||
|
job_args:
|
||||||
|
extra_vars:
|
||||||
|
artifact_url: "{{ event.payload.data.artifact_url }}"
|
||||||
@@ -6,9 +6,15 @@
|
|||||||
ansible.eda.webhook:
|
ansible.eda.webhook:
|
||||||
port: 5000
|
port: 5000
|
||||||
host: 0.0.0.0
|
host: 0.0.0.0
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- name: Show payload
|
- name: Run Template
|
||||||
condition: 1 == 1
|
condition:
|
||||||
|
all:
|
||||||
|
- event.payload.data.artifact_url is defined
|
||||||
action:
|
action:
|
||||||
debug:
|
run_job_template:
|
||||||
|
name: bab-deploy-application
|
||||||
|
organization: OYS
|
||||||
|
job_args:
|
||||||
|
extra_vars:
|
||||||
|
artifact_url: "{{ event.payload.data.artifact_url }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user