BacklogZero®

Ansible in a Minute · Ansible Core ·

Use ignore_errors to continue after a failed command

Short answer

Set ignore_errors so Ansible continues the play on a host after a task returns failed.

Subscribe for updates

Get an email whenever we publish new guides and blog posts. Unsubscribe anytime.

By subscribing you agree we may email you about Ansible in a Minute and related Level Up Labs updates. We store your address in the same lead sheet as our contact form.

Request

run /bin/false with ignore_errors and then print that the play continued

Example

A quick heads-up: Every environment is different. Review and test this example before you run it on systems you care about.

YAML
---
- name: Continue after a failed command
  hosts: all
  gather_facts: false
  tasks:
    - name: Run a command that fails
      ansible.builtin.command: /bin/false
      ignore_errors: true

    - name: Print that the play continued
      ansible.builtin.debug:
        msg: The play continued after the failed command

How it works

By default Ansible stops tasks on a host when a task fails on that host. ignore_errors lets the next task run after a failed result.

When to use it

  • Optional commands that may fail without stopping the play
  • Continuing a host after a known-soft failure

Requirements

  • Ansible: >=2.14

Validation

  • Syntax validated
  • Not execution-tested
  • Last verified 2026-09-17

Notes

ignore_errors applies only when the task runs and returns failed. It does not ignore undefined-variable errors, connection failures, missing interpreters, or syntax errors. Use failed_when when you must decide failure from stdout. Use block/rescue when you must recover.

Reference

Built for every Ansible use case in every organization

BacklogZero can generate this kind of automation in your environment, just like it did here.

Get BacklogZero today

Related guides

Back to Ansible in a Minute

Use ignore_errors to continue after a failed command · Level Up Labs