Ansible & Configuration
Failure rescue blocks
Use block, rescue and always to run recovery steps when a task fails, and treat a rescued host in the run recap as a problem to check before the release is called done.
What you will be able to do
- Explain what block, rescue and always each do when a task in the block fails.
- Decide when a rescue section fits a failure and when ignore_errors would hide it.
What is in the lesson
- A real situation where this goes wrong
- How it works, step by step
- A walkthrough with commands you can run
- How it fails in production, and how to tell
- Three quiz questions with explanations
Read this lessonFree. No account needed.
More in Ansible & Configuration
- Rolling updatesAdvanced · 4 min
Roll a change through an Ansible fleet in batches with serial, so part of the service keeps answering while each group updates, and a drain step keeps traffic away from…
- serial batchesAdvanced · 4 min
Read serial values, percentages and failure thresholds together, so you know which hosts have already changed when a play stops during a rollout, and how percentage…
- Ansible factsAdvanced · 4 min
Read Ansible facts through ansible_facts, know when gather_facts is off, and check the fact a condition reads before trusting its branch on each host, using a debug…
- Performance tuningAdvanced · 4 min
Measure task time first, then change forks, pipelining or fact gathering one at a time, and watch control node load and shared services, so a faster run does not hide a…
- Molecule testingAdvanced · 4 min
Test a role on a clean instance with Molecule, using a scenario, a converge step and a verify step that checks the real result, not just that a package exists.
- Patch managementAdvanced · 4 min
Plan OS patching as a cycle of inventory, staged test, batched apply, reboot and verify, using the apt upgrade option deliberately rather than as a blanket upgrade.