Serial per group

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

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’.

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

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

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

Regards,
Joost