From 3db4464a97d6e338a87da28885379b0f83fda977 Mon Sep 17 00:00:00 2001 From: Michal Nasiadka Date: Fri, 5 Jul 2024 07:23:26 +0200 Subject: [PATCH] Fix etc hosts generation for interfaces with dashes Partial-Bug: #2070051 Change-Id: I03cdea3edf9b53cdce254c209997ed984e084b18 (cherry picked from commit ec4d03c3ba22923b1c8f9891799393402c4f52c0) --- roles/etc_hosts/tasks/etc-hosts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/etc_hosts/tasks/etc-hosts.yml b/roles/etc_hosts/tasks/etc-hosts.yml index 5c1b26a..39ae0d5 100644 --- a/roles/etc_hosts/tasks/etc-hosts.yml +++ b/roles/etc_hosts/tasks/etc-hosts.yml @@ -28,7 +28,7 @@ marker: "# {mark} ANSIBLE GENERATED HOSTS" block: | {% for host in groups['baremetal'] %} - {% set api_interface = hostvars[host]['api_interface'] %} + {% set api_interface = (hostvars[host]['api_interface'] | replace('-', '_')) %} {% if host not in groups['bifrost'] or api_interface in hostvars[host].ansible_facts %} {% set hostnames = [hostvars[host].ansible_facts.nodename, hostvars[host].ansible_facts.hostname] %} {{ 'api' | kolla_address(host) }} {{ hostnames | unique | join(' ') }}