async_status – Obtain status of asynchronous task

Synopsis

  • This module gets the status of an asynchronous task.

  • This module is also supported for Windows targets.

Parameters

Parameter Choices/Defaults Comments
jid
string / required
Job or task identifier
mode
string
    Choices:
  • cleanup
  • status ←
If status, obtain the status.
If cleanup, clean up the async job cache (by default in ~/.ansible_async/) for the specified job jid.

Notes

Note

  • This module is also supported for Windows targets.

See Also

See also

Asynchronous Actions and Polling

Detailed information on how to use asynchronous actions and polling.

Examples

---
- name: Asynchronous yum task
  yum:
    name: docker-io
    state: present
  async: 1000
  poll: 0
  register: yum_sleeper

- name: Wait for asynchronous job to end
  async_status:
    jid: '{{ yum_sleeper.ansible_job_id }}'
  register: job_result
  until: job_result.finished
  retries: 30

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
ansible_job_id
string
success
The asynchronous job id

Sample:
360874038559.4169
finished
integer
success
Whether the asynchronous job has finished (1) or not (0)

Sample:
1
started
integer
success
Whether the asynchronous job has started (1) or not (0)

Sample:
1


Status

Red Hat Support

More information about Red Hat’s support of this module is available from this Red Hat Knowledge Base article.

Authors

  • Ansible Core Team

  • Michael DeHaan

Hint

If you notice any issues in this documentation you can edit this document to improve it.