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
All checks were successful
Build and Release / Build Windows Exe (push) Successful in 10s
This commit is contained in:
@@ -61,8 +61,8 @@ def generate_inventory(servers: Dict[str, Server], flows: List[Flow]) -> Dict[st
|
||||
match_count += 1
|
||||
|
||||
# Prepare host entry if new
|
||||
# We use the IP as the key in inventory 'hosts'
|
||||
host_key = server.ip_address
|
||||
# We use the Reference/Hostname as the key in inventory 'hosts'
|
||||
host_key = server.reference or server.hostname or server.ip_address
|
||||
|
||||
if host_key not in inventory_hosts:
|
||||
host_vars = server.get_ansible_vars()
|
||||
|
||||
@@ -23,6 +23,9 @@ class Server:
|
||||
# Default ssh is usually fine, but being explicit doesn't hurt
|
||||
pass
|
||||
|
||||
if self.ip_address:
|
||||
vars['ansible_host'] = self.ip_address
|
||||
|
||||
return vars
|
||||
|
||||
@dataclass
|
||||
|
||||
Reference in New Issue
Block a user