mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
allow for null values in yaml inventory (#26765)
* allow for null values in yaml inventory * 3 dad3 dad3 dad3 dad3 dad3 dad3 dad3 dad
This commit is contained in:
parent
5c6e5d4841
commit
aca11a28a2
1 changed files with 3 additions and 3 deletions
|
@ -126,16 +126,16 @@ class InventoryModule(BaseFileInventoryPlugin):
|
|||
if section in group_data and isinstance(group_data[section], string_types):
|
||||
group_data[section] = {group_data[section]: None}
|
||||
|
||||
if 'vars' in group_data:
|
||||
if group_data.get('vars', False):
|
||||
for var in group_data['vars']:
|
||||
self.inventory.set_variable(group, var, group_data['vars'][var])
|
||||
|
||||
if 'children' in group_data:
|
||||
if group_data.get('children', False):
|
||||
for subgroup in group_data['children']:
|
||||
self._parse_group(subgroup, group_data['children'][subgroup])
|
||||
self.inventory.add_child(group, subgroup)
|
||||
|
||||
if 'hosts' in group_data:
|
||||
if group_data.get('hosts', False):
|
||||
for host_pattern in group_data['hosts']:
|
||||
hosts, port = self._parse_host(host_pattern)
|
||||
self.populate_host_vars(hosts, group_data['hosts'][host_pattern] or {}, group, port)
|
||||
|
|
Loading…
Reference in a new issue