(cherry picked from commit 30a651bca3
)
This commit is contained in:
parent
132346cb6a
commit
843ebcc436
1 changed files with 9 additions and 9 deletions
|
@ -46,8 +46,8 @@ To avoid timeouts on a task, specify its maximum runtime and how frequently you
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
- name: simulate long running op (15 sec), wait for up to 45 sec, poll every 5 sec
|
- name: Simulate long running op (15 sec), wait for up to 45 sec, poll every 5 sec
|
||||||
command: /bin/sleep 15
|
ansible.builtin.command: /bin/sleep 15
|
||||||
async: 45
|
async: 45
|
||||||
poll: 5
|
poll: 5
|
||||||
|
|
||||||
|
@ -76,8 +76,8 @@ To run a playbook task asynchronously::
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
- name: simulate long running op, allow to run for 45 sec, fire and forget
|
- name: Simulate long running op, allow to run for 45 sec, fire and forget
|
||||||
command: /bin/sleep 15
|
ansible.builtin.command: /bin/sleep 15
|
||||||
async: 45
|
async: 45
|
||||||
poll: 0
|
poll: 0
|
||||||
|
|
||||||
|
@ -89,15 +89,15 @@ To run a playbook task asynchronously::
|
||||||
|
|
||||||
If you need a synchronization point with an async task, you can register it to obtain its job ID and use the :ref:`async_status <async_status_module>` module to observe it in a later task. For example::
|
If you need a synchronization point with an async task, you can register it to obtain its job ID and use the :ref:`async_status <async_status_module>` module to observe it in a later task. For example::
|
||||||
|
|
||||||
- name: 'YUM - async task'
|
- name: Run an async task
|
||||||
yum:
|
ansible.builtin.yum:
|
||||||
name: docker-io
|
name: docker-io
|
||||||
state: present
|
state: present
|
||||||
async: 1000
|
async: 1000
|
||||||
poll: 0
|
poll: 0
|
||||||
register: yum_sleeper
|
register: yum_sleeper
|
||||||
|
|
||||||
- name: 'YUM - check on async task'
|
- name: Check on an async task
|
||||||
async_status:
|
async_status:
|
||||||
jid: "{{ yum_sleeper.ansible_job_id }}"
|
jid: "{{ yum_sleeper.ansible_job_id }}"
|
||||||
register: job_result
|
register: job_result
|
||||||
|
@ -131,7 +131,7 @@ To run multiple asynchronous tasks while limiting the number of tasks running co
|
||||||
# execute_batch.yml
|
# execute_batch.yml
|
||||||
#####################
|
#####################
|
||||||
- name: Async sleeping for batched_items
|
- name: Async sleeping for batched_items
|
||||||
command: sleep {{ async_item }}
|
ansible.builtin.command: sleep {{ async_item }}
|
||||||
async: 45
|
async: 45
|
||||||
poll: 0
|
poll: 0
|
||||||
loop: "{{ durations }}"
|
loop: "{{ durations }}"
|
||||||
|
|
Loading…
Reference in a new issue