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

How would you implement blue/green deployment with Ansible?

AdvancedProductionRolling Updates, Delegation and Safe Deployments
Answer

Run two identical environments, with one live. Ansible (1) provisions or updates the idle one with the new release, (2) runs smoke tests against it directly, (3) switches traffic by flipping the load balancer listener rule, target group weights, or DNS record, and (4) keeps the old environment for fast rollback, then retires it later.

Rollback is the same switch in reverse, taking seconds. The hard parts are not in Ansible: backward-compatible database schema changes, session state, and the doubled infrastructure cost during the overlap. Use amazon.aws or community.aws modules for target groups, listener rules or Route 53 weights, and guard the switch with a verification task.

All Ansible questions Roadmap: Ansible

More on Rolling Updates, Delegation and Safe Deployments