host_group_vars: skip files having blacklisted ending (#25730)
* vars: skip backup files * vars: extend doc for ignored files
This commit is contained in:
parent
2ff464c949
commit
6feee18292
1 changed files with 2 additions and 1 deletions
|
@ -23,6 +23,7 @@ DOCUMENTATION:
|
|||
description:
|
||||
- Loads YAML vars into corresponding groups/hosts in group_vars/ and host_vars/ directories.
|
||||
- Files are restricted by extension to one of .yaml, .json, .yml or no extension.
|
||||
- Hidden (starting with '.') and backup (ending with '~') files and directories are ignored.
|
||||
- Only applies to inventory sources that are existing paths.
|
||||
notes:
|
||||
- It takes the place of the previously hardcoded group_vars/host_vars loading.
|
||||
|
@ -121,7 +122,7 @@ class VarsModule(BaseVarsPlugin):
|
|||
|
||||
found = []
|
||||
for spath in os.listdir(path):
|
||||
if not spath.startswith('.'): # skip hidden
|
||||
if not spath.startswith('.') and not spath.endswith('~'): # skip hidden and backups
|
||||
|
||||
ext = os.path.splitext(spath)[-1]
|
||||
full_spath = os.path.join(path, spath)
|
||||
|
|
Loading…
Reference in a new issue