BacklogZero®

Ansible in a Minute · Ansible Core ·

Use ignore_unreachable to continue after an unreachable host

Short answer

Set ignore_unreachable so Ansible continues after a host cannot be contacted.

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

ping hosts with ignore_unreachable 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 when a host is unreachable
  hosts: all
  gather_facts: false
  tasks:
    - name: Ping and ignore unreachable hosts
      ansible.builtin.ping:
      ignore_unreachable: true

    - name: Print that the play continued
      ansible.builtin.debug:
        msg: "Play continued after an unreachable host"

How it works

By default an unreachable host is removed from the play. ignore_unreachable keeps that host in the play and runs the next task. Later tasks still try to contact the host unless you ignore them too.

When to use it

  • Gathering status from a mixed online and offline inventory
  • Continuing a play when some hosts cannot be reached

Requirements

  • Ansible: >=2.14

Validation

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

Notes

ignore_unreachable applies to connection failures, not to a task that runs and returns failed. Use ignore_errors for a failed result on a reachable host. You can set ignore_unreachable on a play, a block, or a task.

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_unreachable to continue after an unreachable host · Level Up Labs