Hide "[WARNING]: No inventory was parsed" message (#65499)

* Add config option INVENTORY_UNPARSED_WARNING to hide the warning "No inventory was parsed, only implicit localhost is available"
pull/77477/head
Jon "The Nice Guy" Spriggs 2 years ago committed by GitHub
parent 6216c9fc93
commit 5b44035983
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
minor_changes:
- Add a new "INVENTORY_UNPARSED_WARNING" flag add to hide the "No inventory was parsed, only implicit localhost is available" warning

@ -394,6 +394,18 @@ LOCALHOST_WARNING:
- {key: localhost_warning, section: defaults}
type: boolean
version_added: "2.6"
INVENTORY_UNPARSED_WARNING:
name: Warning when no inventory files can be parsed, resulting in an implicit inventory with only localhost
default: True
description:
- By default Ansible will issue a warning when no inventory was loaded and notes that
it will use an implicit localhost-only inventory.
- These warnings can be silenced by adjusting this setting to False.
env: [{name: ANSIBLE_INVENTORY_UNPARSED_WARNING}]
ini:
- {key: inventory_unparsed_warning, section: defaults}
type: boolean
version_added: "2.14"
DOC_FRAGMENT_PLUGIN_PATH:
name: documentation fragment plugins path
default: ~/.ansible/plugins/doc_fragments:/usr/share/ansible/plugins/doc_fragments

@ -232,7 +232,7 @@ class InventoryManager(object):
else:
if C.INVENTORY_UNPARSED_IS_FAILED:
raise AnsibleError("No inventory was parsed, please check your configuration and options.")
else:
elif C.INVENTORY_UNPARSED_WARNING:
display.warning("No inventory was parsed, only implicit localhost is available")
for group in self.groups.values():

Loading…
Cancel
Save