async_status¶
Collection Note
This module is part of the ansible.builtin collection. To install the collection, use:
Added in version0.5.
Synopsis¶
- This module gets the status of an asynchronous task.
- This module is also supported for Windows targets.
Parameters¶
| Parameter | Defaults / Choices | Comments |
|---|---|---|
| jid str required |
Job or task identifier | |
| mode str |
Default: status Choices: cleanup, status |
If V(status), obtain the status. If V(cleanup), clean up the async job cache (by default in C(~/.ansible_async/)) for the specified job O(jid), without waiting for it to finish. |
Notes¶
Note
- The RV(started) and RV(finished) return values were updated to return V(True) or V(False) instead of V(1) or V(0) in ansible-core 2.19.
Examples¶
---
- name: Asynchronous dnf task
ansible.builtin.dnf:
name: docker-io
state: present
async: 1000
poll: 0
register: dnf_sleeper
- name: Wait for asynchronous job to end
ansible.builtin.async_status:
jid: '{{ dnf_sleeper.ansible_job_id }}'
register: job_result
until: job_result is finished
retries: 100
delay: 10
- name: Clean up async file
ansible.builtin.async_status:
jid: '{{ dnf_sleeper.ansible_job_id }}'
mode: cleanup
Return Values¶
| Key | Data Type | Description | Returned |
|---|---|---|---|
| ansible_job_id | str | The asynchronous job id | success |
| erased | str | Path to erased job file | when file is erased |
| finished | bool | Whether the asynchronous job has finished or not | always |
| started | bool | Whether the asynchronous job has started or not | always |
| stderr | str | Any errors returned by async_wrapper | always |
| stdout | str | Any output returned by async_wrapper | always |
Authors¶
- Ansible Core Team
- Michael Dehaan