EX294 Implement advanced Ansible automation Practice Question
A playbook uses the 'block' and 'rescue' keywords to handle errors. The block contains three tasks. The first task fails. What happens next?
⚠ Common exam trap
Many candidates confuse `block`/`rescue` with a simple retry mechanism or assume that all tasks in the block must complete before error handling, but Ansible's behavior is to immediately jump to rescue on the first failure.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The rescue section runs immediately after the failure.
In Ansible, when a task inside a `block` fails, the `rescue` section is executed immediately after the failure, without running any remaining tasks in the block. This is analogous to a try-catch mechanism in programming: the block is the 'try', and the rescue is the 'catch'. Option B correctly describes this behavior.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The rescue section runs and retries the failed task.
Why it's wrong here
Rescue does not retry; it handles the error.
- ✓
The rescue section runs immediately after the failure.
Why this is correct
Rescue is executed when any task in the block fails.
- ✗
The playbook fails with an error message.
Why it's wrong here
Rescue prevents the playbook from failing if it succeeds.
- ✗
The remaining tasks in the block run, then the rescue section runs.
Why it's wrong here
The block stops at the first failure.
Go deeper
Related to this question
About these practice questions
This EX294 question is part of Courseiva's 520-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This EX294 practice question is part of Courseiva's free Red Hat certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the EX294 exam.