Courseiva

How to Abort an Ansible Rolling Update on Any Failure

An Ansible rolling update playbook has 'serial: 1' and 'max_fail_percentage: 0'. During the update of a 5-host group, the first host fails. What is the outcome?

Quick Answer

The play aborts immediately because max_fail_percentage: 0 sets the failure tolerance for the batch to zero, meaning even a single host failure is enough to exceed the threshold and halt execution - with serial: 1, each batch consists of exactly one host, so as soon as that one host fails, 100% of the current batch has failed, which is well above the 0% ceiling that has been configured. Ansible does not wait to see how the remaining hosts would have done, retry the failed host, or skip ahead; it stops the play right there, which is the entire purpose of setting max_fail_percentage that low - it is a deliberate choice to treat any failure during a sensitive rolling update as a signal to stop rather than push forward. This is different from leaving max_fail_percentage unset, where Ansible's default behavior is more tolerant and continues past individual host failures. When a scenario combines a small or single-host serial batch size with a strict max_fail_percentage, the exam is testing whether you understand that the percentage is evaluated per batch, not across the whole inventory, so a tiny batch size makes even one failure disproportionately likely to cross the threshold and abort the run.

⚠ Common exam trap

Many exam-takers assume 'serial: 1' means the play will skip the failed host and continue with the next, but 'max_fail_percentage: 0' overrides that by aborting on any 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 play aborts immediately

With 'serial: 1', Ansible updates one host at a time. 'max_fail_percentage: 0' means that if any host fails (0% failure tolerance), the entire playbook run is aborted immediately. When the first host fails, Ansible stops further execution because the failure percentage exceeds the threshold, and no retries or continuation occur.

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 play pauses for manual intervention

    Why it's wrong here

    Ansible has no pause-for-manual-intervention behaviour; max_fail_percentage: 0 aborts the play immediately when the first host fails. Pausing is tempting because it sounds like a safe rollout gate, and it would be correct if the playbook used a pause task or serial with explicit prompts.

  • ✗

    The play retries the failed host

    Why it's wrong here

    Ansible does not automatically retry a failed host; with max_fail_percentage: 0 the play aborts once the first host fails. Retrying is tempting because retries exist in other automation tools, and it would be correct where a task uses until/retries, which is explicit, not implicit.

  • ✓

    The play aborts immediately

    Why this is correct

    With `serial: 1`, each host forms its own batch, so the first host's failure leaves a 100% batch failure rate. Since `max_fail_percentage: 0` permits no failures, Ansible aborts the play immediately, preventing any remaining hosts from being updated.

  • ✗

    The play continues with the remaining 4 hosts

    Why it's wrong here

    With max_fail_percentage: 0, any failure exceeds the threshold, so Ansible aborts the play instead of proceeding to the remaining hosts. Continuing is tempting because serial: 1 suggests independent batches, and it would be correct if max_fail_percentage were set above zero.

  • ✗

    The play marks the host as unreachable and continues

    Why it's wrong here

    A failed task is not the same as an unreachable host, and max_fail_percentage: 0 halts the play rather than continuing. Marking unreachable and continuing is tempting because Ansible does skip unreachable hosts, but that applies to connection failures, not task failures.

About these practice questions

This EX294 question is part of Courseiva's 392-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 →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

3 more ways this is tested on EX294

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A company uses Ansible to manage rolling updates of a web server fleet. During a deployment, the playbook fails on one host due to a transient network error, and the rest of the fleet is left in an inconsistent state. Which strategy would best minimize the risk of inconsistency in future rolling updates?

medium
  • A.Add retries to each task so transient errors are automatically retried.
  • B.Use a larger serial batch size to complete the rollout faster.
  • C.Set ignore_errors: yes on all tasks to continue despite failures.
  • ✓ D.Set max_fail_percentage to 0 in the serial block to abort the rollout on any failure.

Why D: Setting `max_fail_percentage: 0` in a rolling update (using `serial`) tells Ansible to abort the entire playbook run if any single host fails. This prevents the rest of the fleet from being updated, avoiding an inconsistent state where some hosts have the new deployment and others do not. It directly addresses the risk of partial rollouts caused by transient errors.

Variation 2. An Ansible rolling update playbook includes 'max_fail_percentage: 20'. If more than 20% of hosts fail during any batch, what happens?

medium
  • A.The play pauses and waits for user input
  • B.The failed hosts are removed from inventory
  • C.The play retries failed hosts
  • ✓ D.The play aborts immediately
  • E.The play continues with remaining hosts

Why D: The `max_fail_percentage` parameter in Ansible's rolling update strategy defines the maximum percentage of hosts that can fail in a single batch before the playbook aborts entirely. When the failure rate exceeds this threshold, Ansible stops execution immediately to prevent cascading failures or inconsistent state across the remaining hosts.

Variation 3. Which TWO Ansible playbook parameters directly control the number of host failures allowed before aborting a rolling update?

hard
  • ✓ A.max_fail_percentage
  • ✓ B.any_errors_fatal
  • C.throttle
  • D.serial
  • E.ignore_errors

Why A: Option A, max_fail_percentage, is correct because it sets a threshold percentage of hosts in the current batch that may fail before Ansible aborts the play for the remaining hosts, directly governing how many failures are tolerated during a rolling update. Option B, any_errors_fatal, is correct because when set to true it causes the play to abort immediately on the first host failure, effectively controlling whether any failure stops the rolling update. Option C, throttle, is incorrect because it limits the number of hosts executing a task concurrently, not the number of failures allowed. Option D, serial, is incorrect because it defines the batch size (how many hosts are updated per iteration), not the failure tolerance. Option E, ignore_errors, is incorrect because it allows a task to continue despite failure rather than controlling when the play aborts based on host failures.

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.