Interview Prep/Ansible/Rolling Updates, Delegation and Safe Deployments

When would you use an Auto Scaling Group instance refresh instead of rolling out with Ansible?

AdvancedProductionRolling Updates, Delegation and Safe Deployments
Answer

For stateless services on immutable images, replace instances instead of changing them. Ansible builds the new AMI (via Packer), updates the launch template, and triggers an ASG instance refresh with minimum healthy percentage and warm-up settings. AWS handles draining, replacement and health checks. This is more reliable than patching in place, since every instance is born from the same tested image.

Ansible can orchestrate it with the autoscaling modules in amazon.aws and community.aws (for example community.aws.autoscaling_instance_refresh). Keep in-place rolling plays for stateful hosts, appliances and anything that cannot be replaced cheaply.

All Ansible questions Roadmap: Ansible

More on Rolling Updates, Delegation and Safe Deployments