-
Notifications
You must be signed in to change notification settings - Fork 423
/
async_tasks.yml
53 lines (43 loc) · 1023 Bytes
/
async_tasks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
- hosts: all
gather_facts: false
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"
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
async: 30
poll: 0
register: fired
- debug:
msg: "I'm another debug message."
- name: Examine slow command
async_status: jid={{ fired.ansible_job_id }}
register: slow_command
until: slow_command.finished
retries: 20
- name: Fire and forget a slow reversal
shell: |
sleep 10
rm -f /tmp/test_file
async: 30
poll: 0
register: fired
- debug:
msg: "I'm yet another debug message."
- name: Examine slow reversal
async_status: jid={{ fired.ansible_job_id }}
register: slow_command
until: slow_command.finished
retries: 20