I pass variable 'host' to do some work on just one host of a environment:
- name: Perform an action on a host
hosts: "{{ host }}"
roles:
- role: mule_action
When the host is not in the inventory it produces [WARNING]: Could not match supplied host pattern, ignoring: MuleQ01
I need this to fail so it shows up in jenkins (my orchestrator for Ansible) as a failed build.
My ansible.cfg looks like this:
[defaults]
strategy_plugins = /usr/lib/python3.6/site-packages/ansible_mitogen/plugins/strategy
strategy = mitogen_linear
host_key_checking = False
roles_path = roles
unparsed_is_failed = True
host_pattern_mismatch = error
inventory = inventory
Running: ansible 2.9.7 config file = /data/ansible.cfg configured module search path = ['/home/mule/.ansible/plugins/modules',/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3.6/site-packages/ansible executable location = /usr/bin/ansible python version = 3.6.9 (default, Oct 17 2019, 11:10:22) [GCC 8.3.0]