diff --git a/playbooks/deploy_application.yml b/playbooks/deploy_application.yml index 926d9ec..d9c8856 100644 --- a/playbooks/deploy_application.yml +++ b/playbooks/deploy_application.yml @@ -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