- name: run update
hosts: tag_app_servers:&tag_active_servers
serial: 7
sudo: True
pre_tasks:
-name : Gathering ec2 facts
action: ec2_facts
# do the deregistration here
roles:
-some_role
-some_other_role
post_tasks:
# re -register boxes here.
In fact, Ansible thinks that all my servers are the same (as they should), and does not distinguish between servers in different regions. Therefore, although I hope to start from the 7 regions where I am Take out one server from each region in and run updates on it in parallel, but Ansible can take out 7 servers from one region and completely weaken it. This is not a big problem because the traffic is just transferred to other regions, but it Far from ideal. When running multiple server updates in parallel, what is a good way to force it to obtain servers from different regions?
Using Ansible 2.x looks like strategies will do what you want, but you may have to write a custom strategy plugin to get the specific you want Behavior.
Now, with Ansible 1.x, you can group instances in such a way that each group has one server in each region, and then run playbooks for each group one at a time. This It’s a bit messy, but it will do what you want.
I’m running a rolling deployment on a server on ec2 through Ansible. I use serial parameters on several machines at once Run the deployment on the server as follows:
- name: run update
hosts: tag_app_servers:&tag_active_servers
serial: 7
sudo: True
pre_tasks:
-name: Gathering ec2 facts
action: ec2_facts
# do the deregistration here
roles:
-some_role
-some_other_role
post_tasks:
# re-register boxes here.
In fact, Ansible thinks all my servers are the same (it should be), and does not distinguish between different Regional servers. So, although I want to take one server from each of the 7 regions I’m in and run updates on it in parallel, Ansible can take 7 servers from one region and completely weaken it. This Not a big problem, because the traffic is only transferred to other regions, but it is far from ideal. When running multiple server updates in parallel, what is a good way to force it to obtain servers from different regions?
This is not possible with Ansible 1.x. When serializing a playbook, it just switches the server to any group.
p>
Using Ansible 2.x looks like strategies will do what you want, but you may have to write a custom strategy plugin to get the specific behavior you want.
Now, use With Ansible 1.x, you can group instances in such a way that each group has one server in each region, and then run the playbook for each group one at a time. It’s a bit messy, but it will do what you want.