Skip to content

Instantly share code, notes, and snippets.

@medlefsen
Created February 6, 2014 00:48
Show Gist options
  • Save medlefsen/8836433 to your computer and use it in GitHub Desktop.
Save medlefsen/8836433 to your computer and use it in GitHub Desktop.
Ansible patch
diff --git a/lib/ansible/runner/action_plugins/group_by.py b/lib/ansible/runner/action_plugins/group_by.py
index f8b4f31..4d6205c 100644
--- a/lib/ansible/runner/action_plugins/group_by.py
+++ b/lib/ansible/runner/action_plugins/group_by.py
@@ -83,7 +83,8 @@ class ActionModule(object):
inv_group = ansible.inventory.Group(name=group)
inventory.add_group(inv_group)
for host in hosts:
- del self.runner.inventory._vars_per_host[host]
+ if host in self.runner.inventory._vars_per_host:
+ del self.runner.inventory._vars_per_host[host]
inv_host = inventory.get_host(host)
if not inv_host:
inv_host = ansible.inventory.Host(name=host)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment