ansible/ansible — pull request #7468 by maxamillion (2014-05-21 01:36:58+00:00)
Title: add async fire-forget/check functionality

I've added the code suggested by "x93..." (I have no other identifier for this person to offer them credit) in [this thread](https://groups.google.com/forum/#!searchin/ansible-project/async/ansible-project/PGlY46HS6LM/Z60BT3vEnhcJ) on the ansible mailing list.

From the testing I've done it works just fine and I added some docs on how to use it.

The following is a playbook I used for testing.

```
---
# test async checking
#
- hosts: all
remote_user: root
tasks:
- name: 'YUM - test normal async'
yum: name=docker-io state=installed
async: 20
poll: 2

- name: 'YUM - fire and forget task'
yum: name=docker-io state=installed
async: 1000
poll: 0
register: yum_sleeper

- name: 'YUM - check on fire and forget task'
async_status: jid={{ yum_sleeper.ansible_job_id }}
register: job_result
until: job_result.finished
retries: 30

- name: 'SHELL - test normal async'
shell: 'for i in {1..10}; do printf "$i \n"; sleep 1; done'
async: 20
poll: 2

- name: 'SHELL - fire and forget task'
shell: 'for i in {1..10}; do printf "$i \n"; sleep 1; done'
async: 1000
poll: 0
register: shell_sleeper

- name: 'SHELL - check on fire and forget task'
async_status: jid={{ shell_sleeper.ansible_job_id }}
register: job_result
until: job_result.finished
retries: 30
```