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

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.

All Ansible questions Roadmap: Ansible

More on Rolling Updates, Delegation and Safe Deployments