�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
Z
d d l Z d d l m
Z
d d
l m Z d d l m Z d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont stableinterfacet statust coret supported_bys
---
module: async_status
short_description: Obtain status of asynchronous task
description:
- This module gets the status of an asynchronous task.
- This module is also supported for Windows targets.
version_added: "0.5"
options:
jid:
description:
- Job or task identifier
type: str
required: true
mode:
description:
- If C(status), obtain the status.
- If C(cleanup), clean up the async job cache (by default in C(~/.ansible_async/)) for the specified job I(jid).
type: str
choices: [ cleanup, status ]
default: status
notes:
- This module is also supported for Windows targets.
seealso:
- ref: playbooks_async
description: Detailed information on how to use asynchronous actions and polling.
author:
- Ansible Core Team
- Michael DeHaan
s)
---
- 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
s|
ansible_job_id:
description: The asynchronous job id
returned: success
type: str
sample: '360874038559.4169'
finished:
description: Whether the asynchronous job has finished (C(1)) or not (C(0))
returned: success
type: int
sample: 1
started:
description: Whether the asynchronous job has started (C(1)) or not (C(0))
returned: success
type: int
sample: 1
N( t
AnsibleModule( t iteritems( t to_nativec
C` s7 t d t d t d d d t � d t d d d d d d
d g � d t d d d t � � � } | j d } | j d } | j d } t j j | � } t j j | | � } t j j | � s� | j d
d d | d d d d � n | d
k rt j
| � | j d | d | � n d } y. t
| � � } t j | j � � } Wd QXWnh t k
r�| s�| j d | d | d d d d � q�| j d | d | d
d | d d d d � n Xd | k r�d | d <| | d <n d | k r�d | d <n t g t | � D] \ } } t | � | f ^ q�� } | j | � d S( Nt
argument_spect jidt typet strt requiredt modet defaultR t choicest cleanupt
_async_dirt patht msgs could not find jobt ansible_job_idt startedi t finishedt erasedt results_filei s Could not parse job output: %s( R t dictt Truet paramst osR t
expandusert joint existst fail_jsont unlinkt exit_jsont Nonet opent jsont loadst readt ExceptionR R
(
t moduleR R t async_dirt logdirt log_patht datat ft kt v( ( sP /usr/lib/python2.7/site-packages/ansible/modules/utilities/logic/async_status.pyt mainY s<