Hi,
For one of my use cases, I would like to trigger multiple playbook simultaneously, but in the playbook all the tasks will be serial, i.e. Playbook 1, 2, 3 will be triggered simultaneously, but Tasks 2 in Playbook 1, will wait for task 1 to complete and so on.
I know i can mark each long running task as fire-forget, But in this particular case, Tasks are dependent, So task 2 needs something from task 1. So playbook will be long running.
Would be nice if i can have a master playbook and include other playbooks in fire-forget mode.
Please let me know if there are any hacks or better method i can use to achieve the above goal ?
Regards,
Ok so right now you can’t have a playbook that sets “async: True” as the default for every task in it (ditto for async_poll). I am totally fine for patches that allow this as a playbook option though and then it would set any tasks that didn’t have it set.
We already do this for sudo/sudo_user/etc. However it’s not true that the playbook itself would occur serially, you would be starting task 1, 2, 3, etc with no wait.
If you want the playbooks to all go parallel, that’s different.
AWX is not going to offer this in the 1st release in a few weeks, but it’s something I’m looking to build in a follow on, so allow jobs to spawn child jobs in parallel.
Alternatively you can do that now by a shell script that backgrounds some processes and waits on the PIDs, though the above is going to be a lot cleaner.
Yes, I dont want entire tasks in playbook to be async. I want current default behavior in the playbook.
But when 1 playbook, when i
- include: playbookB.yml
- include: playbookC.yml
Both should be triggered in parallel, But tasks in both playbook will work as they do now. Do you think this would be possible?
For now ill probably use the shell script idea.
Regards,
Yeah see the last half of my email above.
The playbooks would not be in parallel, which is why you need the shell script or that future jobs feature.
Hi Michael DeHaan ,
I am just getting started with Ansible and would appreciate if you can give an example of shell script to background playbacks for executing them in parallel.
Regards
Rahul Mehrotra