We use ansible to configure some hosts, including IP configuration. We do not want to use a DHCP server. Sometimes we add new hosts to the network. Those new hosts are in one ip address range and the existing production hosts are in another. We just put new hosts in the first network and then let ansible configure them, test them and change the IP to the production range. Ansible is run regularly via cron.

However, when there a no new hosts, ansible will report an unreachable error. No new hosts is the usual situation. How can I suppress that or make it less prominent?

Basically our playbook looks like this:

#  configure existing hosts
- hosts: production
    - name: do regular maintenance
      # ...

- hosts: new
  # Does not seem to do anything
  ignore_errors: True 
    - name: configure freshly discovered host
        # ...
    - name: test freshly discovered host
        # ...
    - name: change ip config to production network
        # ...

The /etc/ansible/hosts looks like this:


# those are firewalled

When I run this I see a big red

PLAY RECAP   ****************************************************              : ok=0    changed=0    unreachable=1    failed=0   

at the end, which is confusing for my colleagues.

I have seen this question, and I figured that if I use ignore_errors but don't set a flag it should silently skip the unreachable hosts, but it does not seem to have any effect.

4 Answers 4


Going to add this answer: a fix was added in Ansible 2.7: https://github.com/ansible/ansible/blob/stable-2.7/changelogs/CHANGELOG-v2.7.rst#major-changes

New keyword ignore_unreachable for plays and blocks. Allows ignoring tasks that fail due to unreachable hosts, and check results with is unreachable test.

EDIT: From personal experience, I need to add ignore_errors along with it for the playbook to actually continue.


Append to your oneline ansible |grep -A1 'rc=0'.
This will only show the passing plays / servers.


You'd need to create a callback plugin to modify the way Ansible produces its output.

You can start with default.py provided as an example with Ansible. Search for the unreachable string and modify the script to suit your needs.

For example, to make it less prominent, you can for example override the value of COLOR_UNREACHABLE variable.

Save the modified code to callback_plugins in your project directory, point to the directory, and enable the plugin in the ansible.cfg configuration file.


One way I found was to run this script against my hosts file first, and then edit the list accordingly. Then run the Ansible script.

It's a work around but still better than having to keep an eye on Ansible all the time waiting for it to stop again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.