W3cubDocs

/Ansible 2.10

ansible.builtin.async_status – Obtain status of asynchronous task

Note

This module is part of ansible-base and included in all Ansible installations. In most cases, you can use the short module name async_status even without specifying the collections: keyword. Despite that, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.

New in version 0.5: of ansible.builtin

Synopsis

  • This module gets the status of an asynchronous task.
  • This module is also supported for Windows targets.

Note

This module has a corresponding action plugin.

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: 100
  delay: 10

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


Authors

  • Ansible Core Team
  • Michael DeHaan

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/ansible/builtin/async_status_module.html