For Ansible 1.9-develop Pull request 601 had the fix for Issue 383, which does affect our production ASG about every two weeks or so. We use the ec2_asg module to refresh our ASG instances 3 times a day.
I was eager to test. In doing so, I noticed that the replace_all_instances or replace_instances options cause extra set of scaling events. Has anyone else who uses either replace_ option see this happen? See below for the screen shot which demonstrates the behavior.
We have one instance in two different Availability Zones. So we use a batch size of two (actually a formula based upon the length of the availability_zones list of the ASG).
Interesting… I just tested with batch_size: 1. The extra set of scaling events was 1. I.e. one new instance launched and one new instance terminated.
The batch_size logic is broken. I am going open an Issue in ansible-modules-core, but welcome others to note their experience here. I’ll update this topic with a link to the Issue, too.
`
-
name: Retrieve Auto Scaling Group properties
local_action:
module: ec2_asg
name: “{{ asg_name }}”
state: present
health_check_type: ELB
register: result_asg -
name: Auto Scaling Group properties
debug: var=result_asg -
name: Replace current instances with fresh instances
local_action:
module: ec2_asg
name: “{{ asg_name }}”
state: present
min_size: “{{ result_asg.min_size }}”
max_size: “{{ result_asg.max_size }}”
desired_capacity: “{{ result_asg.desired_capacity }}”
health_check_type: “{{ result_asg.health_check_type }}”
lc_check: no
replace_all_instances: yes
replace_batch_size: “{{ result_asg.availability_zones | length() }}”
`
- and 2. are expected. a. - d. are extra scaling events.