mirror of
https://github.com/kubevirt/kubevirt.core.git
synced 2026-03-26 19:03:16 +00:00
fix: Explicity set ansible_port
Explicitly set ansible_port so it is reset in AWX inventories if the value changes from set to unset. Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
This commit is contained in:
@@ -639,6 +639,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
||||
Secondary interfaces have priority over a service exposing SSH
|
||||
"""
|
||||
ansible_host = None
|
||||
ansible_port = None
|
||||
if opts.kube_secondary_dns and opts.network_name is not None:
|
||||
# Set ansible_host to the kubesecondarydns derived host name if enabled
|
||||
# See https://github.com/kubevirt/kubesecondarydns#parameters
|
||||
@@ -654,10 +655,11 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
||||
port = self.get_port_from_service(service)
|
||||
if host is not None and port is not None:
|
||||
ansible_host = host
|
||||
self.inventory.set_variable(vmi_name, "ansible_port", port)
|
||||
ansible_port = port
|
||||
|
||||
# Default to the IP address of the interface if ansible_host was not set prior
|
||||
if ansible_host is None:
|
||||
ansible_host = ip_address
|
||||
|
||||
self.inventory.set_variable(vmi_name, "ansible_host", ansible_host)
|
||||
self.inventory.set_variable(vmi_name, "ansible_port", ansible_port)
|
||||
|
||||
Reference in New Issue
Block a user