37 lines
1.1 KiB
YAML
37 lines
1.1 KiB
YAML
---
|
|
- 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
|