From 1bad617f29c2a17efc8d5702cdce0b6522f0ab26 Mon Sep 17 00:00:00 2001 From: Pilou Date: Tue, 11 Dec 2018 21:17:05 +0100 Subject: [PATCH] Inventory plugins move auto before ini (#44428) * inventory plugins: try auto before ini auto plugin should run before ini to avoid ini being able to parse some plugin configuration YAML files successfully. * Update comment comment was added by 2ffe3c42bb15263ad67dd36842712d9d3ec99070 but related code was later removed by 506e6a0b2d49a147e1c0c0b301c71163ea785d71. --- docs/docsite/rst/plugins/inventory.rst | 2 +- examples/ansible.cfg | 2 +- lib/ansible/config/base.yml | 2 +- lib/ansible/inventory/manager.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/docsite/rst/plugins/inventory.rst b/docs/docsite/rst/plugins/inventory.rst index 6d53c12d06d..5b69686c511 100644 --- a/docs/docsite/rst/plugins/inventory.rst +++ b/docs/docsite/rst/plugins/inventory.rst @@ -22,7 +22,7 @@ config file that ships with Ansible: .. code-block:: ini [inventory] - enable_plugins = host_list, script, yaml, ini, auto + enable_plugins = host_list, script, auto, yaml, ini This list also establishes the order in which each plugin tries to parse an inventory source. Any plugins left out of the list will not be considered, so you can 'optimize' your inventory loading by minimizing it to what you actually use. For example: diff --git a/examples/ansible.cfg b/examples/ansible.cfg index b7904afc948..a93ee3e8e56 100644 --- a/examples/ansible.cfg +++ b/examples/ansible.cfg @@ -324,7 +324,7 @@ #any_errors_fatal = False [inventory] -# enable inventory plugins, default: 'host_list', 'script', 'yaml', 'ini', 'auto' +# enable inventory plugins, default: 'host_list', 'script', 'auto', 'yaml', 'ini' #enable_plugins = host_list, virtualbox, yaml, constructed # ignore these extensions when parsing a directory as inventory source diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml index 996dbddc8fa..475c09182a4 100644 --- a/lib/ansible/config/base.yml +++ b/lib/ansible/config/base.yml @@ -1442,7 +1442,7 @@ INVENTORY_CACHE_TIMEOUT: - {key: cache_timeout, section: inventory} INVENTORY_ENABLED: name: Active Inventory plugins - default: ['host_list', 'script', 'yaml', 'ini', 'toml', 'auto'] + default: ['host_list', 'script', 'auto', 'yaml', 'ini', 'toml'] description: List of enabled inventory plugins, it also determines the order in which they are used. env: [{name: ANSIBLE_INVENTORY_ENABLED}] ini: diff --git a/lib/ansible/inventory/manager.py b/lib/ansible/inventory/manager.py index 1f43cea447c..62d3e87b9a2 100644 --- a/lib/ansible/inventory/manager.py +++ b/lib/ansible/inventory/manager.py @@ -263,7 +263,7 @@ class InventoryManager(object): if plugin_wants: try: - # in case plugin fails 1/2 way we dont want partial inventory + # FIXME in case plugin fails 1/2 way we have partial inventory plugin.parse(self._inventory, self._loader, source, cache=cache) parsed = True display.vvv('Parsed %s inventory source with %s plugin' % (source, plugin_name))