Fix etc hosts generation for interfaces with dashes

Partial-Bug: #2070051
Change-Id: I03cdea3edf9b53cdce254c209997ed984e084b18
(cherry picked from commit ec4d03c3ba22923b1c8f9891799393402c4f52c0)
This commit is contained in:
Michal Nasiadka 2024-07-05 07:23:26 +02:00
parent fc2f4634a8
commit 3db4464a97

View File

@ -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(' ') }}