mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
made format more flexible and allow for non dict entries
This commit is contained in:
parent
8f7c879574
commit
c648c95eb7
1 changed files with 6 additions and 0 deletions
|
@ -27,6 +27,7 @@ from ansible.inventory.group import Group
|
|||
from ansible.inventory.expand_hosts import detect_range
|
||||
from ansible.inventory.expand_hosts import expand_hostname_range
|
||||
from ansible.parsing.utils.addresses import parse_address
|
||||
from ansible.compat.six import string_types
|
||||
|
||||
class InventoryParser(object):
|
||||
"""
|
||||
|
@ -77,6 +78,11 @@ class InventoryParser(object):
|
|||
self.groups[group] = Group(name=group)
|
||||
|
||||
if isinstance(group_data, dict):
|
||||
#make sure they are dicts
|
||||
for section in ['vars', 'children', 'hosts']:
|
||||
if section in group_data and isinstance(group_data[section], string_types):
|
||||
group_data[section] = { group_data[section]: None}
|
||||
|
||||
if 'vars' in group_data:
|
||||
for var in group_data['vars']:
|
||||
if var != 'ansible_group_priority':
|
||||
|
|
Loading…
Reference in a new issue