Skip to content

Commit

Permalink
config: use path list for default inventory
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
resmo authored and bcoca committed Sep 7, 2017
1 parent f4fff54 commit da488a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions lib/ansible/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,7 @@ def parse(self):
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):
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/config/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit da488a8

Please sign in to comment.