CertGrid CertGrid
Hands-on Lab·Ansible

Ansible Error Handling with ignore_errors and block

By default a failed task removes that host from the rest of the play while the others carry on - which is neither obviously right nor obviously wrong until you have seen it. This shows the default, then ignore_errors, then deciding for yourself what counts as failure, then block/rescue/always, and finally stopping everything at once.

Plays and Playbooks Guide 16 of 45 Intermediate

rescue makes the play continue: a handled failure is counted as rescued rather than failed, and the play carries on afterwards. That is what makes block/rescue a real error-handling construct rather than a fancier ignore_errors.

Both managed nodes, because the default behaviour - one host failing while another continues - cannot be shown with one.
Server NameIP AddressOSRolesCPURAMHDD
ANS-CTL01192.168.0.36Ubuntu 26.04 LTSAnsible Control Node2 Core3 GB50 GB
ANS-A01192.168.0.37Ubuntu 26.04 LTSManaged Node (group: web)2 Core3 GB50 GB
ANS-B01192.168.0.38Ubuntu 26.04 LTSManaged Node (group: db)2 Core3 GB50 GB

This guide includes

Use this when one failing task should not remove a host from the rest of the play. This matters because that removal is the default - and deciding for yourself what counts as failure is very often the real fix.

Before you start

  1. The configuration this guide assumes

  2. The default is to stop that host

  3. Ignoring an error

  4. Deciding yourself what counts as failure

  5. block, rescue, always

  6. One host failing versus all of them

Official sources