Async+polling now operational, here are some things to try

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

And now /bin/ansible will poll like I was talking about.

Imagine you have 500 systems and set forks (-f) to 20.

20 systems at a time we will initiate the background job

Once all hosts are kicked (async), we’ll poll for completion, 20 at a time.

This should be crazy efficient for kicking off long running jobs now.

I have yet to add this to playbooks, but once done, this will also make playbooks pretty great for long running steps where you have to make sure all the nodes are done before moving on.

Think multimode deployment with long database migrations and such before you can bounce the web app to pick up the new code. This will probably get done in playbooks early next week.

–Michael

–Michael