# Serial per group

**URL:** <https://forum.ansible.com/t/serial-per-group/14132>\
**Category:** Ansible Project\
**Created:** [December 11, 2013, 9:42pm UTC](https://forum.ansible.com/t/serial-per-group/14132 "2013-12-11T21:42:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joost\_Cassee](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@Joost\_Cassee](https://forum.ansible.com/u/Joost_Cassee)\
**Post date:** [December 11, 2013, 9:42pm UTC](https://forum.ansible.com/t/serial-per-group/14132/1 "2013-12-11T21:42:24Z")

</div>

Hi,

The serial option is a great way of upgrading servers behind a load balancer. One of the example playbooks has a HAProxy example that I used, and it works great. I set the serial option upto half of the hosts and the service continues running. I am excited about the new “serial: 50%” pull request.

I now have a number of haproxy-servers groups, mainly for production, staging, etc. Is it possible to get the serial execution to take hosts from all groups proportionally?

Example inventory:

[live]  
lb-live  
s[1:8]-live

[staging]  
lb-staging  
s[1:2]-staging

If I use “serial: 4”, all of staging could go out at once, if I use “serial: 1” the production environment takes much too long to upgrade. “serial: 50%” would probably not work in this case.

Of course I could separate my staging and production environments into separate inventory files and run Ansible twice. Can that be avoided?

Regards,  
Joost

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [December 11, 2013, 9:45pm UTC](https://forum.ansible.com/t/serial-per-group/14132/2 "2013-12-11T21:45:08Z")

</div>

I have it both ways, I use an inventory dir with inventory/{dev,qa,staging,production} files, using -i, I can choose all envs or just one. Also you can run with run with --limit ‘staging’ and --limit ‘produciton’.

---

<div class="post-metadata">

**Author:** ![kahlil.hodgson](https://avatars.discourse-cdn.com/v4/letter/k/b9bd4f/32.png) [@kahlil.hodgson](https://forum.ansible.com/u/kahlil.hodgson)\
**Post date:** [December 11, 2013, 10:06pm UTC](https://forum.ansible.com/t/serial-per-group/14132/3 "2013-12-11T22:06:23Z")

</div>

I use to additional groups, 'left' and 'right', to split my 'testing',  
'staging', and 'production' groups in half. So I can use, say,

--limit 'testing:&left'

to run a playbook against the left half of my testing servers, or

--limit 'production:&right'

to run a playbook against the right half of my production servers.

Or I can have a playbook that runs two plays

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [December 11, 2013, 10:25pm UTC](https://forum.ansible.com/t/serial-per-group/14132/4 "2013-12-11T22:25:15Z")

</div>

hehe, i use odd/even, but same concept (my naming convention lends itself well to this)

---

<div class="post-metadata">

**Author:** ![Joost\_Cassee](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@Joost\_Cassee](https://forum.ansible.com/u/Joost_Cassee)\
**Post date:** [December 12, 2013, 10:54am UTC](https://forum.ansible.com/t/serial-per-group/14132/5 "2013-12-12T10:54:36Z")

</div>

Brian, Kahlil, good suggestion to split up the servers manually and  
run two plays. Thanks!

Regards,  
Joost
