An Ansible playbook run during a deploy failed on 3 of 20 servers. What state is the fleet in and what do you do?
IntermediateScenarioDeployments and releases
Answer
Situation read → You have a mixed fleet: some servers on the new version, some partially changed. Mixed is dangerous if the versions are incompatible.
What I'd do →
- Read the play recap and the failed tasks; Ansible writes failed hosts to a retry file if
retry_files_enabledis on, otherwise copy them from the recap. - Take the 3 failed hosts out of the load balancer.
- Fix the cause (disk full, package repo timeout, a service that didn't start) and rerun only on them:
ansible-playbook deploy.yml --limit @deploy.retry
# or
ansible-playbook deploy.yml --limit web07,web12,web15
- Idempotent playbooks make the rerun safe; that's the payoff of writing them properly.
- Next time, use
serial: 5withmax_fail_percentage: 10so a failure stops the rollout early instead of hitting the whole fleet.
Why → serial turns a fleet-wide deploy into batches, which is a rolling update for VMs.
Interview tip → Mention serial and max_fail_percentage.
More on Deployments and releases
A deploy went out and p99 latency doubled. Walk me through it.IntermediateYou deployed a new version and half the pods are in CrashLoopBackOff. What do you do?BeginnerA release passed every test in staging but broke in production. How do you investigate?IntermediateHow would you design a zero-downtime deployment for a stateless API on Kubernetes?BeginnerEvery deploy causes a short spike of 502 errors from the ALB. Why, and how do you fix it?IntermediateHow would you set up a canary release, and what decides whether it gets promoted?Intermediate