matrix-docker-ansible-deploy/roles/matrix-awx/tasks/export_server.yml

44 lines
1.3 KiB
YAML
Raw Normal View History

2021-10-10 05:23:49 +00:00
---
2021-08-13 08:05:57 +00:00
- name: Run export of /matrix/ and snapshot the database simultaneously
command: "{{ item }}"
2021-08-13 08:05:57 +00:00
with_items:
- /bin/sh /usr/local/bin/awx-export-service.sh 1 0
- /bin/sh /usr/local/bin/awx-export-service.sh 0 1
2021-10-10 05:23:49 +00:00
register: awx_create_instances
2021-08-13 08:05:57 +00:00
async: 3600 # Maximum runtime in seconds.
poll: 0 # Fire and continue (never poll)
- name: Wait for both of these jobs to finish
async_status:
jid: "{{ item.ansible_job_id }}"
2021-10-10 05:23:49 +00:00
register: awx_jobs
until: awx_jobs.finished
2021-08-13 08:05:57 +00:00
delay: 5 # Check every 5 seconds.
retries: 720 # Retry for a full hour.
2021-10-10 05:23:49 +00:00
with_items: "{{ awx_create_instances.results }}"
2021-08-13 08:05:57 +00:00
- name: Schedule deletion of the export in 24 hours
at:
command: rm /chroot/export/matrix*
count: 1
units: days
unique: true
2021-08-13 08:05:57 +00:00
- name: Delete the AWX session token for executing modules
awx.awx.tower_token:
description: 'AWX Session Token'
scope: "write"
state: absent
existing_token_id: "{{ awx_session_token.ansible_facts.tower_token.id }}"
tower_host: "https://{{ awx_host }}"
tower_oauthtoken: "{{ awx_session_token.ansible_facts.tower_token.token }}"
2021-08-13 08:05:57 +00:00
- name: Set boolean value to exit playbook
set_fact:
2021-10-10 05:23:49 +00:00
awx_end_playbook: true
2021-08-13 08:05:57 +00:00
- name: End playbook if this task list is called.
meta: end_play
2021-10-10 05:23:49 +00:00
when: awx_end_playbook is defined and awx_end_playbook|bool