diff options
Diffstat (limited to 'lib/ansible/modules/async_status.py')
-rw-r--r-- | lib/ansible/modules/async_status.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/ansible/modules/async_status.py b/lib/ansible/modules/async_status.py index 3609c460..c54ce3c6 100644 --- a/lib/ansible/modules/async_status.py +++ b/lib/ansible/modules/async_status.py @@ -23,8 +23,8 @@ options: 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). + - 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. type: str choices: [ cleanup, status ] default: status @@ -70,6 +70,11 @@ EXAMPLES = r''' until: job_result.finished retries: 100 delay: 10 + +- name: Clean up async file + ansible.builtin.async_status: + jid: '{{ yum_sleeper.ansible_job_id }}' + mode: cleanup ''' RETURN = r''' @@ -79,12 +84,12 @@ ansible_job_id: type: str sample: '360874038559.4169' finished: - description: Whether the asynchronous job has finished (C(1)) or not (C(0)) + description: Whether the asynchronous job has finished (V(1)) or not (V(0)) returned: always type: int sample: 1 started: - description: Whether the asynchronous job has started (C(1)) or not (C(0)) + description: Whether the asynchronous job has started (V(1)) or not (V(0)) returned: always type: int sample: 1 @@ -107,7 +112,7 @@ import os from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.six import iteritems -from ansible.module_utils._text import to_native +from ansible.module_utils.common.text.converters import to_native def main(): @@ -124,8 +129,7 @@ def main(): async_dir = module.params['_async_dir'] # setup logging directory - logdir = os.path.expanduser(async_dir) - log_path = os.path.join(logdir, jid) + log_path = os.path.join(async_dir, jid) if not os.path.exists(log_path): module.fail_json(msg="could not find job", ansible_job_id=jid, started=1, finished=1) |