Here are a few things to test:
A long running op that is given 30 seconds to complete and polls every 5 seconds
ansible host -B 30 -P 2 -a “/bin/sleep 15”
A long running operation that is given 15 seconds to complete but takes 30 and will timeout
ansible host -B 15 -P 2 -a “/bin/sleep 30”
An operation that will complete before it gets polled the first time
ansible host -B 30 -P 10 -a “/bin/sleep 1”
An operation that we aren’t going to poll on at all
ansible host -B 30 -a “/bin/sleep 10”
Though we can check the job results manually
ansible host -m async_status jid=<insert_jid_here>
I think this is working pretty decently, testing welcome.
Note that any module can be async’d, not just the command module.
I have to teach playbooks these tricks too, but before I do, I’m going to make it such that polling is done in /bin/ansible and not runner… because I want to start tasks on all nodes and then poll for them, rather than only starting the tasks on some of the nodes. This will be much more efficient.
–Michael