I have the following configuration in haproxy.
backend 1
machine-1 machine-1.com:8080
machine-2 machine-2.com:8080
machine-3 machine-3.com:8080
machine-4 machine-4.com:8080
machine-5 machine-5.com:8080
machine-6 machine-6.com:8080
machine-7 machine-7.com:8080
machine-8 machine-8.com:8080
machine-9 machine-9.com:8080
machine-10 machine-10.com:8080
backend 2
machine-11 machine-11.com:8080
machine-12 machine-12.com:8080
Serial is set to 50% in ansible rolling deployment
.We also change the state of the machines to maintenance in this window. Thus ansible puts machine 1-6 in maintenance mode in the first go while making 7-12 as maintenance in the second go.
As it puts 7-12 as maintenance in the second go; the backend 2 cluster has no nodes online to take the traffic. This causes a huge number of issues on the application side.
How should I remediate this? I am using ansible 2.0.0.
EDIT 1
Two solutions that I can think of
Looking for solutions other than these. more in the line of using ansible to solve it.
Creating a host groups
for each backend and run the update for each backend group in a separate run would be IMHO the best solution. If there is no way to do that it is possible to define batch sizes as a list since Ansible 2.2.
So this should work:
- name: test play
hosts: backend servers.
serial:
- 5
- 1