mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 05:12:45 +00:00
made format more flexible and allow for non dict entries
This commit is contained in:
@@ -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':
|
||||
|
||||
Reference in New Issue
Block a user