From 7b3c17136a033105bad24df0afae64751eccf848 Mon Sep 17 00:00:00 2001 From: L3D Date: Wed, 6 Jul 2022 18:13:26 +0200 Subject: [PATCH] update inventory creation --- inventory.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/inventory.py b/inventory.py index 7dc3294..3f79ce5 100755 --- a/inventory.py +++ b/inventory.py @@ -10,7 +10,7 @@ import json # create a dict to match hostnames to enviroments env_dict = { 'work': - ['workstation.local'], + ['workstation.local', 'daringdoo.local'], 'private': ['derpy.local', 'applejack.local'] } @@ -19,7 +19,10 @@ def fqdn(): """ return fully qualified domain name """ - return socket.getfqdn() + hostname = socket.gethostname() + if '.' not in hostname: + hostname = f"{hostname}.local" + return str(hostname) def env(domain): """