Amazon-EC2 – Can I use the ANSIBLE “SERIAL” parameter to specify the area?

I am running a rolling deployment on a server on ec2 through Ansible. I use serial parameters to run the deployment on several servers at a time, as shown below:

- 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?

It’s impossible with Ansible 1.x. When serializing a script, it’s just Switch the server to any group.

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.

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.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1867 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.