Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
1 change: 1 addition & 0 deletions roles/asg_management/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ In order to manipulate an AWS Autoscaling Group (ASG) your `deploy` user must ha
* `autoscaling:SuspendProcesses`
* `autoscaling:DescribeScalingProcessTypes`
* `autoscaling:DescribeAutoScalingGroups`
* `autoscaling:StartInstanceRefresh`

Set the `asg_management.name` to the machine name of your ASG in order to automatically suspend and resume autoscaling on build.

Expand Down
2 changes: 1 addition & 1 deletion roles/asg_management/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ asg_management:
#profile: "example" # optional, the boto profile name to use if not the system default
region: "eu-west-1"
suspend_processes: "Launch Terminate HealthCheck" # space separated string, see https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html
pause: 5 # how long in seconds to wait before polling the AWS API again for instance statuses
pause: 10 # localhost ping count, to wait before polling the AWS API again for instance statuses (instead of ansible 'pause' module which seems to be buggy and hangs sometimes)
5 changes: 3 additions & 2 deletions roles/asg_management/tasks/asg_target_health.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
- name: Pause so as to not hammer the AWS API.
ansible.builtin.pause:
seconds: "{{ asg_management.pause }}"
ansible.builtin.command:
cmd: "ping localhost -c {{ asg_management.pause }}"
failed_when: false

- name: Empty the target list.
ansible.builtin.set_fact:
Expand Down