1 Commits

Author SHA1 Message Date
8b3584fa9e Use server reference as inventory key and add ansible_host var
All checks were successful
Build and Release / Build Windows Exe (push) Successful in 10s
2026-02-06 15:51:30 -05:00
2 changed files with 5 additions and 2 deletions

View File

@@ -61,8 +61,8 @@ def generate_inventory(servers: Dict[str, Server], flows: List[Flow]) -> Dict[st
match_count += 1 match_count += 1
# Prepare host entry if new # Prepare host entry if new
# We use the IP as the key in inventory 'hosts' # We use the Reference/Hostname as the key in inventory 'hosts'
host_key = server.ip_address host_key = server.reference or server.hostname or server.ip_address
if host_key not in inventory_hosts: if host_key not in inventory_hosts:
host_vars = server.get_ansible_vars() host_vars = server.get_ansible_vars()

View File

@@ -23,6 +23,9 @@ class Server:
# Default ssh is usually fine, but being explicit doesn't hurt # Default ssh is usually fine, but being explicit doesn't hurt
pass pass
if self.ip_address:
vars['ansible_host'] = self.ip_address
return vars return vars
@dataclass @dataclass