Compare commits
23 Commits
99714f7f86
...
devel
| Author | SHA1 | Date | |
|---|---|---|---|
|
c8485bc35b
|
|||
|
51709f6ee9
|
|||
|
19f498e091
|
|||
|
6e153d16b1
|
|||
|
b905507bb8
|
|||
|
b69162d79e
|
|||
|
a8c73b569a
|
|||
|
ed1bd120e4
|
|||
|
79b2b6f28f
|
|||
|
fd576bef97
|
|||
|
dbcf8688a5
|
|||
|
e054cd2125
|
|||
|
d3e99ef12b
|
|||
|
39f379ae1e
|
|||
|
e0732bb8bd
|
|||
|
a6dcf660b6
|
|||
|
6dca08d9d8
|
|||
|
57f65f81c9
|
|||
|
e651d2c21f
|
|||
|
37114c3eb1
|
|||
|
1073ce1fb1
|
|||
|
7b1fa91b41
|
|||
|
c727a81986
|
4
.gitignore
vendored
4
.gitignore
vendored
@@ -268,4 +268,6 @@ context/
|
|||||||
collections/ansible_collections/
|
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"
|
||||||
}
|
}
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Deploy BAB Frontend Application
|
|
||||||
hosts: bab1.mgmt.toal.ca
|
|
||||||
become: true
|
|
||||||
vars:
|
|
||||||
artifact_version: 0.0.2
|
|
||||||
artifact_job: 10
|
|
||||||
artifact_url: https://gitea.toal.ca/oys/bab-app/actions/runs/10/artifacts/build-artifact-{{ artifact_version }}.{{ artifact_job }}
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
- name: Download zip file from url
|
|
||||||
ansible.builtin.get_url:
|
|
||||||
url: "{{ artifact_url }}"
|
|
||||||
dest: /tmp/BABFrontend.zip
|
|
||||||
mode: '0644'
|
|
||||||
|
|
||||||
- name: Unzip file to temp directory
|
|
||||||
ansible.builtin.unarchive:
|
|
||||||
src: /tmp/BABFrontend.zip
|
|
||||||
dest: /tmp
|
|
||||||
remote_src: true
|
|
||||||
|
|
||||||
- name: Extract tgz file to nginx directory
|
|
||||||
ansible.builtin.unarchive:
|
|
||||||
src: /tmp/build-artifact-{{ artifact_version}}.{{ artifact_job}}/build-{{ artifact_version }}.tar.gz
|
|
||||||
dest: /usr/share/nginx/html
|
|
||||||
remote_src: true
|
|
||||||
|
|
||||||
- name: Cleanup temp directory
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: /tmp/build-artifact-{{ artifact_version }}.{{ artifact_job }}
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: Clean up artifact download
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: /tmp/BABFrontend.zip
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
36
playbooks/deploy_application.yml
Normal file
36
playbooks/deploy_application.yml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
---
|
||||||
|
- name: Deploy BAB Frontend Application
|
||||||
|
hosts: bab1.mgmt.toal.ca
|
||||||
|
become: false
|
||||||
|
tasks:
|
||||||
|
- name: Create temporary directory
|
||||||
|
ansible.builtin.tempfile:
|
||||||
|
state: directory
|
||||||
|
suffix: .deploy
|
||||||
|
register: tempdir
|
||||||
|
|
||||||
|
- name: Download zip file from url
|
||||||
|
ansible.builtin.get_url:
|
||||||
|
url: "{{ artifact_url }}"
|
||||||
|
dest: /{{ tempdir.path }}/BABFrontend.zip
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
# Temporary until this drops: https://github.com/ansible/ansible/issues/81092
|
||||||
|
- name: Unzip downloaded file
|
||||||
|
ansible.builtin.unarchive:
|
||||||
|
src: "{{ tempdir.path }}/BABFrontend.zip"
|
||||||
|
dest: "{{ tempdir.path }}"
|
||||||
|
list_files: true
|
||||||
|
remote_src: true
|
||||||
|
register: unzip_result
|
||||||
|
|
||||||
|
- 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:
|
||||||
|
path: "{{ tempdir.path }}"
|
||||||
|
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 }}"
|
||||||
20
rulebooks/gitea_webhook.yml
Normal file
20
rulebooks/gitea_webhook.yml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
- name: Listen for Gitea Webhooks
|
||||||
|
hosts: all
|
||||||
|
sources:
|
||||||
|
- name: Ansible webhook listener
|
||||||
|
ansible.eda.webhook:
|
||||||
|
port: 5000
|
||||||
|
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 }}"
|
||||||
Reference in New Issue
Block a user