From 94ba0f740ace51391bf31dca6033cdb0d9dc15b1 Mon Sep 17 00:00:00 2001 From: Stoned Elipot Date: Thu, 16 May 2013 18:57:05 +0200 Subject: [PATCH] Fix for issue #2916 : for each host promote the host variables as globally scoped variables for the sake of the groups determination --- lib/ansible/runner/action_plugins/group_by.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ansible/runner/action_plugins/group_by.py b/lib/ansible/runner/action_plugins/group_by.py index aab4ad94fe..7d2740116d 100644 --- a/lib/ansible/runner/action_plugins/group_by.py +++ b/lib/ansible/runner/action_plugins/group_by.py @@ -55,9 +55,12 @@ class ActionModule(object): groups = {} for host in self.runner.host_set: - if not check_conditional(template.template(self.runner.basedir, self.runner.conditional, inject)): + data = {} + data.update(inject) + data.update(inject['hostvars'][host]) + if not check_conditional(template.template(self.runner.basedir, self.runner.conditional, data)): continue - group_name = template.template(self.runner.basedir, args['key'], inject) + group_name = template.template(self.runner.basedir, args['key'], data) group_name = group_name.replace(' ','-') if group_name not in groups: groups[group_name] = []