From 8acbc00853f48982d61539752ee2b4b378671ac6 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Thu, 17 Sep 2015 10:24:03 -0400 Subject: [PATCH] Fixing groups variable structure to match v1 Fixes #12418 --- lib/ansible/vars/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/vars/__init__.py b/lib/ansible/vars/__init__.py index 3fe8ada8580..da4a4b42ec4 100644 --- a/lib/ansible/vars/__init__.py +++ b/lib/ansible/vars/__init__.py @@ -264,7 +264,10 @@ class VariableManager: all_vars['group_names'] = [group.name for group in host.get_groups()] if self._inventory is not None: - all_vars['groups'] = self._inventory.groups.keys() + all_vars['groups'] = dict() + for (group_name, group) in self._inventory.groups.iteritems(): + all_vars['groups'][group_name] = [h.name for h in group.get_hosts()] + if include_hostvars: hostvars = HostVars(vars_manager=self, play=play, inventory=self._inventory, loader=loader) all_vars['hostvars'] = hostvars