From da488a8db5c035634df111d54933dcca962b5636 Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Wed, 6 Sep 2017 20:04:17 +0200 Subject: [PATCH] config: use path list for default inventory This allows to use a pathlist in the ansible.cfg: [default] inventory = path/inventory:other_path/inventory Since ansible allows to use --inventory on CLI more then once, we should also support a pathlist in the config. --- lib/ansible/cli/__init__.py | 4 +--- lib/ansible/config/base.yml | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/ansible/cli/__init__.py b/lib/ansible/cli/__init__.py index 07bf7a69119..6d0292dba15 100644 --- a/lib/ansible/cli/__init__.py +++ b/lib/ansible/cli/__init__.py @@ -596,9 +596,7 @@ class CLI(with_metaclass(ABCMeta, object)): self.options.inventory = [unfrackpath(opt) if ',' not in opt else opt for opt in self.options.inventory] else: - # set default if it exists - if os.path.exists(C.DEFAULT_HOST_LIST): - self.options.inventory = [C.DEFAULT_HOST_LIST] + self.options.inventory = C.DEFAULT_HOST_LIST @staticmethod def version(prog): diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml index 4ba8c460df1..e18f1016331 100644 --- a/lib/ansible/config/base.yml +++ b/lib/ansible/config/base.yml @@ -604,7 +604,7 @@ DEFAULT_HOST_LIST: expand_relative_paths: True ini: - {key: inventory, section: defaults} - type: path + type: pathlist yaml: {key: defaults.inventory} DEFAULT_INTERNAL_POLL_INTERVAL: default: 0.001