From cd2991c02d5fddf1d925d3fe18fe76a8e180cd2c Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Mon, 16 May 2016 14:38:57 -0400 Subject: [PATCH] made format more flexible and allow for non dict entries --- lib/ansible/inventory/yaml.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ansible/inventory/yaml.py b/lib/ansible/inventory/yaml.py index 620ace0d88..552c796071 100644 --- a/lib/ansible/inventory/yaml.py +++ b/lib/ansible/inventory/yaml.py @@ -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':