Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.pyc
.idea

/tower_collection_actual.yml
28 changes: 14 additions & 14 deletions async_tasks.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
---

- hosts: all
gather_facts: false
- name: Run Async Tasks playbooks
hosts: all
gather_facts: true
tasks:

- name: Create the async directory to prevent race conditions
file:
path: ~/.ansible_async
state: directory
run_once: true

- name: Poll a sleep
shell: "sleep 10"
command: "sleep 10"
async: 30
poll: 5

- debug:
msg: "I'm a debug message."

- name: Fire and forget a slow command
shell: |
sleep 15
touch /tmp/test_file
command: "sleep 15 && touch /tmp/test_file"
async: 30
poll: 0
poll: 5
register: fired

- debug:
msg: "I'm another debug message."

- name: Examine slow command
async_status: jid={{ fired.ansible_job_id }}
async_status:
jid: "{{ fired.ansible_job_id }}"
mode: status
register: slow_command
until: slow_command.finished
retries: 20

- name: Fire and forget a slow reversal
shell: |
sleep 10
rm -f /tmp/test_file
command: "sleep 10 && rm -f /tmp/test_file"
async: 30
poll: 0
poll: 5
register: fired

- debug:
msg: "I'm yet another debug message."

- name: Examine slow reversal
async_status: jid={{ fired.ansible_job_id }}
async_status:
jid: "{{ fired.ansible_job_id }}"
mode: status
register: slow_command
until: slow_command.finished
retries: 20