Serial per group

719 views
Skip to first unread message

Joost Cassee

unread,
Dec 11, 2013, 4:42:24 PM12/11/13
to ansible...@googlegroups.com
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

Brian Coca

unread,
Dec 11, 2013, 4:45:08 PM12/11/13
to ansible...@googlegroups.com
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'.

Kahlil Hodgson

unread,
Dec 11, 2013, 5:06:23 PM12/11/13
to ansible...@googlegroups.com
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

---

- name: update left hand side of production
hosts: production:&left
tasks:
- include: tasks/update.yml

- name: update right half of production
hosts: production:&right
tasks:
- include: tasks/update.yml

Because I get to assign hosts to left and right halves in my
inventory, they can be different sizes for testing, production etc.

K


Kahlil (Kal) Hodgson GPG: C9A02289
Head of Technology (m) +61 (0) 4 2573 0382
DealMax Pty Ltd (w) +61 (0) 3 9008 5281

Suite 1415
401 Docklands Drive
Docklands VIC 3008 Australia

"All parts should go together without forcing. You must remember that
the parts you are reassembling were disassembled by you. Therefore,
if you can't get them together again, there must be a reason. By all
means, do not use a hammer." -- IBM maintenance manual, 1925
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.

Brian Coca

unread,
Dec 11, 2013, 5:25:15 PM12/11/13
to ansible...@googlegroups.com
hehe, i use odd/even, but same concept (my naming convention lends itself well to this)


Joost Cassee

unread,
Dec 12, 2013, 5:54:36 AM12/12/13
to ansible...@googlegroups.com
Brian, Kahlil, good suggestion to split up the servers manually and
run two plays. Thanks!

Regards,
Joost

2013/12/11 Brian Coca <bria...@gmail.com>:
> hehe, i use odd/even, but same concept (my naming convention lends itself
> well to this)
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/oC6ML9RaYjg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
--
Joost Cassee
http://joost.cassee.net
Reply all
Reply to author
Forward
0 new messages