2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-09 13:05:49 +00:00

when host is not in hosts file, group_vars is not loaded, change logic to emulate host being in hosts file with no groups to ensure group_vars is loaded which permits use of dynamic grouping in plays

This commit is contained in:
Simon Thompson 2023-07-05 21:25:25 +02:00
parent d0f978548e
commit 45f22c3e31

View File

@ -162,8 +162,9 @@ if __name__ == '__main__':
if os.path.exists('/etc/ansible/hosts'):
aninv = InventoryManager(loader=loader, sources='/etc/ansible/hosts')
anshost = aninv.get_host(sys.argv[1])
if anshost:
invman = aninv
if not anshost:
aninv.add_host(sys.argv[1])
invman = aninv
if not invman:
invlist = sys.argv[1] + ','
invman = InventoryManager(loader=loader, sources=invlist)