Hi Team ,
Is it possible to run Ansible tasks in parallel ? If yes , Kindly let me know How?
Regards,
Prathap
Hi Team ,
Is it possible to run Ansible tasks in parallel ? If yes , Kindly let me know How?
Regards,
Prathap
By default ansible run tasks parallel .but if you feel latency from one host you can use.
Strategy: free
In your play and execute it parallel
Hope that clears your doubts
Regards
Kundan singh
Ok . That was not my question … apologies for that …
I would like to run playbooks parallel . is it possible ?
Regards,
Prathap
No. It's not possible. The utility "ansible-playbook" is not able to
run playbooks in parallel. Only serial execution of plays or imported
playbooks is available. See "import_playbook"
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/import_playbook_module.html
Hypothetical asynchronous task "include_playbook" is probably what you
might be looking for. There is no such module and there are no
options how to create such task. Only tasks can be run in parallel.
See "Asynchronous actions and polling"
https://docs.ansible.com/ansible/latest/user_guide/playbooks_async.html
You'll have to start "ansible-playbook" for each playbook you want to
run in parallel.
Ok … Thank you for the clarification
> I would like to run playbooks parallel . is it possible ?
No. It's not possible. The utility "ansible-playbook" is not able to
run playbooks in parallel. Only serial execution of plays or imported
playbooks is available. See "import_playbook"
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/import_playbook_module.htmlHypothetical asynchronous task "include_playbook" is probably what you
might be looking for. There is no such module and there are no
options how to create such task. Only tasks can be run in parallel.
See "Asynchronous actions and polling"
https://docs.ansible.com/ansible/latest/user_guide/playbooks_async.htmlYou'll have to start "ansible-playbook" for each playbook you want to
run in parallel.
That was exactly what I was going to suggest: start multiple
"ansible-playbook" instances in parallel.
Ok . But I have below two yml files.
There is no dependence between both yml files . Now How can I run them parallel at the same time ? Any advice please ?
i.e :
patching.yml
Ok . But I have below two yml files.
There is no dependence between both yml files . Now How can I run them parallel at the same time ? Any advice please ?
Why do you want them to run in parallel? What are these roles are doing?
Regards
Racke
There is plenty of options. See for example "how to run multiple
shell scripts in parallel"
https://serverfault.com/questions/374131/how-to-run-multiple-shell-scripts-in-parallel
Hi ,
There is no dependency between below two yaml file and also the patching.yaml and second yaml files will be taking at 20 mins to complete task ,hence I am planning to run both yaml file at the same, to reduce the time if it´s possible.
Regards,
Prathap