mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-18 02:40:21 -07:00
Scan group_vars/host_vars in sorted order
This commit is contained in:
parent
97dfa1d335
commit
a9b15ce881
2 changed files with 2 additions and 2 deletions
|
@ -283,7 +283,7 @@ the 'raleigh' group might look like::
|
||||||
It is okay if these files do not exist, as this is an optional feature.
|
It is okay if these files do not exist, as this is an optional feature.
|
||||||
|
|
||||||
As an advanced use case, you can create *directories* named after your groups or hosts, and
|
As an advanced use case, you can create *directories* named after your groups or hosts, and
|
||||||
Ansible will read all the files in these directories. An example with the 'raleigh' group::
|
Ansible will read all the files in these directories in lexicographical order. An example with the 'raleigh' group::
|
||||||
|
|
||||||
/etc/ansible/group_vars/raleigh/db_settings
|
/etc/ansible/group_vars/raleigh/db_settings
|
||||||
/etc/ansible/group_vars/raleigh/cluster_settings
|
/etc/ansible/group_vars/raleigh/cluster_settings
|
||||||
|
|
|
@ -134,7 +134,7 @@ class VarsModule(BaseVarsPlugin):
|
||||||
def _get_dir_files(self, path):
|
def _get_dir_files(self, path):
|
||||||
|
|
||||||
found = []
|
found = []
|
||||||
for spath in os.listdir(path):
|
for spath in sorted(os.listdir(path)):
|
||||||
if not spath.startswith(u'.') and not spath.endswith(u'~'): # skip hidden and backups
|
if not spath.startswith(u'.') and not spath.endswith(u'~'): # skip hidden and backups
|
||||||
|
|
||||||
ext = os.path.splitext(spath)[-1]
|
ext = os.path.splitext(spath)[-1]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue