Update deploy workflow to use a tar in a zip

This commit is contained in:
2024-01-01 11:31:32 -05:00
parent 6e153d16b1
commit 19f498e091

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