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:
parent
db345391e3
commit
dc658eaa1c
1 changed files with 2 additions and 1 deletions
|
@ -83,7 +83,8 @@ class ActionModule(object):
|
||||||
inv_group = ansible.inventory.Group(name=group)
|
inv_group = ansible.inventory.Group(name=group)
|
||||||
inventory.add_group(inv_group)
|
inventory.add_group(inv_group)
|
||||||
for host in hosts:
|
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)
|
inv_host = inventory.get_host(host)
|
||||||
if not inv_host:
|
if not inv_host:
|
||||||
inv_host = ansible.inventory.Host(name=host)
|
inv_host = ansible.inventory.Host(name=host)
|
||||||
|
|
Loading…
Reference in a new issue