1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Check to make sure the host is in the inventory vars cache before clearing it

Fixes #6660
This commit is contained in:
James Cammarata 2014-03-24 15:59:43 -05:00
parent db345391e3
commit dc658eaa1c

View file

@ -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)