Forks when hosts are specified in playbooks

77 views
Skip to first unread message

Mzp45

unread,
Sep 19, 2014, 2:25:51 PM9/19/14
to ansible...@googlegroups.com
Hello,
I have a playbook where the hosts are listed by name instead of "all".  

---
- hosts: host1
  roles:
     - role1
     - role2

- hosts: host2
     - role 1
     - role 3
     - role 5

and so on

However this doesn't help with the forking as it will only execute one host at a time. Is there a way to set it to fork when the playbook is arranged out in this manner?

Thanks

David Karban

unread,
Sep 20, 2014, 5:35:15 AM9/20/14
to ansible...@googlegroups.com
Hi,

that is how ansible works, plays are run in order and paralelism is on play level. I would consider to make several groups in your inventory:

---
- hosts: group1
  roles:
    - role1

- hosts: group2
  roles:
    - role2

- hosts: group3
  roles:
    - role3
    - role5

this way at least role1 will be parallelized.

David

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/462fb88e-f33a-4f95-8916-648b371dae34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
David Karban
Specialista na správu linuxových serverů
www.karban.eu

Mzp45

unread,
Sep 23, 2014, 3:15:50 PM9/23/14
to ansible...@googlegroups.com
Hi Dave,
Thanks for the input. Yeah I kind of know about that but we are not using groups (we do have a reason for that). I'll keep looking around to see if i can get a solution for this particular problem

Thanks

Michael DeHaan

unread,
Sep 23, 2014, 3:19:03 PM9/23/14
to ansible...@googlegroups.com
"we do have a reason for that" -- what's the reason?

Even having groups of one to designate a role can be a good idea.




Mzp45

unread,
Sep 26, 2014, 9:19:39 AM9/26/14
to ansible...@googlegroups.com
A lot of our customers are wary about running roles/updates/fixes across multiple hosts. They prefer having granular control and usually specify which systems they need work done on. But at the same time they'd like to keep track of what roles have been applied to each machine. 

Thanks

Michael DeHaan

unread,
Sep 27, 2014, 9:37:28 AM9/27/14
to ansible...@googlegroups.com
This is possibly a good case for a staging environment or rolling updates, Ansible can be configured to fail if a certain % of a batch don't make it, before adding them back into a pool, etc.

--Michael

Reply all
Reply to author
Forward
0 new messages