LOGBOOK

HELP

Quiz Entry - updated: 2026.11.12

What does Ansible do by default when a task fails on a host?

It stops running further tasks on that host (the rest of its play is skipped) and carries on with the other hosts.

Ansible decides success or failure from the module's result, which for command-like modules is the return code: 0 is success, anything else is failure. By default, the first failure on a host takes that host out of the play. The remaining tasks don't run for it, and handlers it had already notified are dropped. Hosts where the task worked continue normally, and the play recap lists the failed host with failed=1.

This "fail fast" default is safe: continuing after an unexpected error could build on a broken state. But sometimes a failure is expected or can be compensated, so Ansible offers several tools to change the behaviour:

  1. ignore_errors — carry on despite a failure;
  2. force_handlers — run notified handlers even if the play fails;
  3. failed_when — define what counts as failure;
  4. changed_when — define what counts as a change;
  5. block / rescue / always — group tasks and react to failure.

Go deeper:

From Quiz: ITIA / Ansible Task Control: Loops, Conditionals, Handlers and Error Handling | Updated: Nov 12, 2026