How do you do a canary deployment?
IntermediateProductionRolling Updates, Delegation and Safe Deployments
Answer
Either use a growing serial list, or define a canary group in inventory and run the canaries first with a pause for verification.
- hosts: canary
roles: [app]
post_tasks:
- ansible.builtin.pause:
prompt: "Check dashboards for the canary, press Enter to continue"
when: interactive | default(true)
- hosts: web:!canary
serial: "25%"
roles: [app]
In pipelines replace pause with an automated gate that queries error rate and latency (Prometheus API through uri) and fails if thresholds are exceeded. Let the canary run for long enough to see real traffic patterns.
More on Rolling Updates, Delegation and Safe Deployments
How do you do a rolling update with Ansible?BeginnerWhat forms can `serial` take?IntermediateShow the standard pattern for a zero-downtime rolling deploy behind a load balancer.IntermediateWhy do you add a health check inside the deployment play?BeginnerHow do `any_errors_fatal` and `max_fail_percentage` help a rollout?BeginnerHow would you implement blue/green deployment with Ansible?Advanced