Compare commits

...

7 Commits

Author SHA1 Message Date
19f498e091 Update deploy workflow to use a tar in a zip 2024-01-01 11:31:32 -05:00
6e153d16b1 Fix typ 2023-12-30 00:32:13 -05:00
b905507bb8 Fix the vars 2023-12-30 00:25:52 -05:00
b69162d79e Remove Debug 2023-12-30 00:17:43 -05:00
a8c73b569a Update payload path 2023-12-30 00:06:35 -05:00
ed1bd120e4 Add debugging 2023-12-29 23:41:18 -05:00
79b2b6f28f Remove filter 2023-12-29 12:36:49 -05:00
2 changed files with 25 additions and 11 deletions

View File

@@ -3,17 +3,34 @@
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: /tmp/BABFrontend.zip
dest: /{{ tempdir.path }}/BABFrontend.zip
mode: '0644'
# Temporary until this drops: https://github.com/ansible/ansible/issues/81092
- name: Unzip file to web dir
ansible.builtin.command: unzip -o /tmp/BABFrontend.zip -d /usr/share/nginx/html/
- 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: 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:
path: /tmp/BABFrontend.zip
path: "{{ tempdir.path }}"
state: absent

View File

@@ -6,18 +6,15 @@
ansible.eda.webhook:
port: 5000
host: 0.0.0.0
filters:
- ansible.eda.dashes_to_underscores:
rules:
- name: Create facts
- name: Run Template
condition:
all:
- event.payload is defined
- event.payload.artifact_url
- 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.artifact_url
artifact_url: "{{ event.payload.data.artifact_url }}"