0

site.yml

---
- import_playbook: common.yml
- import_playbook: redis.yml
- import_playbook: riak.yml
- import_playbook: webserver.yml
- import_playbook: haproxy.yml

I want to run these playbooks in parallel.
like

- import_playbook: common.yml
# after common.yml run these 4 in parallel
parallel {
- import_playbook: redis.yml
- import_playbook: riak.yml
- import_playbook: webserver.yml
- import_playbook: haproxy.yml
}

How can I do this?

  • i am not aware of an easy way, and it probably will not work on debian/ubuntu because apt will fail if you run multiple apt-get install commands at the same time – sourcejedi Apr 13 at 11:40
1

An option would be to run the other playbooks in the background

> cat project.bash
#!/bin/bash
ansible-playbook common.yml
# Run the other playbooks in the background
ansible-playbook redis.yml > ansible-redis.log &
ansible-playbook riak.yml > ansible-riak.log &
ansible-playbook webserver.yml > ansible-webster.log &
ansible-playbook haproxy.yml > ansible-haproxy.log &

To monitor the project open four other terminals and watch the log with "tail -f ansible- ..."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.