mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-12-27 03:18:31 +01:00
44 lines
1.3 KiB
YAML
44 lines
1.3 KiB
YAML
---
|
|
|
|
- name: Run export of /matrix/ and snapshot the database simultaneously
|
|
command: "{{ item }}"
|
|
with_items:
|
|
- /bin/sh /usr/local/bin/awx-export-service.sh 1 0
|
|
- /bin/sh /usr/local/bin/awx-export-service.sh 0 1
|
|
register: awx_create_instances
|
|
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 }}"
|
|
register: awx_jobs
|
|
until: awx_jobs.finished
|
|
delay: 5 # Check every 5 seconds.
|
|
retries: 720 # Retry for a full hour.
|
|
with_items: "{{ awx_create_instances.results }}"
|
|
|
|
- name: Schedule deletion of the export in 24 hours
|
|
at:
|
|
command: rm /chroot/export/matrix*
|
|
count: 1
|
|
units: days
|
|
unique: yes
|
|
|
|
- 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 }}"
|
|
|
|
- name: Set boolean value to exit playbook
|
|
set_fact:
|
|
awx_end_playbook: true
|
|
|
|
- name: End playbook if this task list is called.
|
|
meta: end_play
|
|
when: awx_end_playbook is defined and awx_end_playbook|bool
|