mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
Fixes #5056 Append new hosts to the groups cache
This commit is contained in:
parent
1f80aa768a
commit
12ed39ef7b
1 changed files with 7 additions and 0 deletions
|
@ -85,6 +85,13 @@ class ActionModule(object):
|
||||||
inventory.add_group(new_group)
|
inventory.add_group(new_group)
|
||||||
grp = inventory.get_group(group_name)
|
grp = inventory.get_group(group_name)
|
||||||
grp.add_host(new_host)
|
grp.add_host(new_host)
|
||||||
|
|
||||||
|
# add this host to the group cache
|
||||||
|
if inventory._groups_list is not None:
|
||||||
|
if group_name in inventory._groups_list:
|
||||||
|
if new_host.name not in inventory._groups_list[group_name]:
|
||||||
|
inventory._groups_list[group_name].append(new_host.name)
|
||||||
|
|
||||||
vv("added host to group via add_host module: %s" % group_name)
|
vv("added host to group via add_host module: %s" % group_name)
|
||||||
result['new_groups'] = groupnames.split(",")
|
result['new_groups'] = groupnames.split(",")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue