ansible.windows.async_status module – Obtain status of asynchronous task

Note

This module is part of the ansible.windows collection (version 2.5.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install ansible.windows.

To use it in a playbook, specify: ansible.windows.async_status.

Synopsis

  • This module gets the status of an asynchronous task.

Parameters

Parameter

Comments

jid

string / required

Job or task identifier

mode

string

If status, obtain the status.

If cleanup, clean up the async job cache (by default in ~/.ansible_async/) for the specified job jid.

Choices:

  • "cleanup"

  • "status" ← (default)

Attributes

Attribute

Support

Description

action

Support: full

Indicates this has a corresponding action plugin so some parts of the options can be executed on the controller

async

Support: none

Supports being used with the async keyword

bypass_host_loop

Support: none

Forces a ‘global’ task that does not execute per host, this bypasses per host templating and serial, throttle and other loop considerations

Conditionals will work as if run_once is being used, variables used will be from the first available host

This action will not work normally outside of lockstep strategies

check_mode

Support: full

added in ansible.windows 2.4.0

Can run in check_mode and return changed status prediction without modifying target, if not supported the action will be skipped.

diff_mode

Support: none

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode

platform

Platform: windows

Target OS/families that can be operated against

See Also

See also

ansible.builtin.async_status

The official documentation on the ansible.builtin.async_status module.

Examples

- name: Asynchronous yum task
  ansible.windows.win_command: my.exe
  async: 1000
  poll: 0
  register: long_cmd

- name: Wait for asynchronous job to end
  ansible.builtin.async_status:
    jid: '{{ long_cmd.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

Description

ansible_job_id

string

The asynchronous job id

Returned: success

Sample: "360874038559.4169"

erased

string

Path to erased job file

Returned: when file is erased

finished

integer

Whether the asynchronous job has finished (1) or not (0)

Returned: always

Sample: 1

started

integer

Whether the asynchronous job has started (1) or not (0)

Returned: always

Sample: 1

stderr

string

Any errors returned by async_wrapper

Returned: always

stdout

string

Any output returned by async_wrapper

Returned: always

Authors

  • Ansible Core Team