diff --git a/lib/ansible/runner/action_plugins/group_by.py b/lib/ansible/runner/action_plugins/group_by.py index b115095c6b..aab4ad94fe 100644 --- a/lib/ansible/runner/action_plugins/group_by.py +++ b/lib/ansible/runner/action_plugins/group_by.py @@ -55,11 +55,9 @@ class ActionModule(object): groups = {} for host in self.runner.host_set: - - data = inject['hostvars'][host] - if not check_conditional(template.template(self.runner.basedir, self.runner.conditional, data)): + if not check_conditional(template.template(self.runner.basedir, self.runner.conditional, inject)): continue - group_name = template.template(self.runner.basedir, args['key'], data) + group_name = template.template(self.runner.basedir, args['key'], inject) group_name = group_name.replace(' ','-') if group_name not in groups: groups[group_name] = []