fail a play if a hosts: value is incorrect?

114 views
Skip to first unread message

zlemini

unread,
Mar 16, 2017, 6:44:00 AM3/16/17
to Ansible Project

Is it possible to configure Ansible to fail early if a hosts: value is incorrect, i.e. doesn't match a target machine in the inventory?

If the hosts: value is undefined like this:

 - name: Test module(s)
   hosts
:


Then Ansible throws this: "ERROR! the field 'hosts' is required but was not set"

I am wondering if similar behaviour can be configured if the hosts: value is misconfigured.

Brian Coca

unread,
Mar 16, 2017, 9:48:41 AM3/16/17
to Ansible Project
It will skip the play cause no groups/hosts match.


----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages