1
0
Fork 0
mirror of https://github.com/DO1JLR/ansible_linux_desktop_setup.git synced 2024-09-14 19:54:51 +02:00

update inventory

This commit is contained in:
L3D 2022-06-26 02:31:29 +02:00
parent 3ec6b23efe
commit 55a693da86
Signed by: l3d
GPG key ID: CD08445BFF4313D1

View file

@ -12,7 +12,7 @@ env_dict = {
'work': 'work':
['workstation.local'], ['workstation.local'],
'private': 'private':
['derpy.local', 'foo.bar'] ['derpy.local', 'applejack.local']
} }
def fqdn(): def fqdn():
@ -29,14 +29,14 @@ def env(domain):
for key, values in env_dict.items(): for key, values in env_dict.items():
if domain in values: if domain in values:
return key return key
print(json.dumps(empty_host_list(), sort_keys=True, indent=2)) print(json.dumps(empty_host_list(domain), sort_keys=True, indent=2))
sys.exit() sys.exit()
def empty_host_list(): def empty_host_list(domain):
""" """
return empty host list return empty host list
""" """
comment = "No valid host found. returning empty host list!" comment = f"No valid host found. Found '{domain}'. Return empty host list!"
return json.loads('{"_meta": {"comment": "' + comment + return json.loads('{"_meta": {"comment": "' + comment +
'", "hostvars": {}}, "instances": {"hosts": []}}') '", "hostvars": {}}, "instances": {"hosts": []}}')