Skip to content

Commit db8ce77

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "baremetal: fix /etc/hosts generation when api_interface has dashes" into stable/victoria
2 parents d26851f + 5bc0721 commit db8ce77

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

ansible/roles/baremetal/tasks/pre-install.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
marker: "# {mark} ANSIBLE GENERATED HOSTS"
2929
block: |
3030
{% for host in groups['baremetal'] %}
31-
{% set api_interface = hostvars[host]['api_interface'] %}
31+
{% set api_interface = hostvars[host]['api_interface'] | replace('-', '_') %}
3232
{% if host not in groups['bifrost'] or 'ansible_' + api_interface in hostvars[host] %}
3333
{% set hostnames = [hostvars[host]['ansible_nodename'], hostvars[host]['ansible_hostname']] %}
3434
{{ 'api' | kolla_address(host) }} {{ hostnames | unique | join(' ') }}
@@ -39,7 +39,7 @@
3939
- customize_etc_hosts | bool
4040
# Skip hosts in the bifrost group that do not have a valid api_interface.
4141
- inventory_hostname not in groups['bifrost'] or
42-
'ansible_' + hostvars[inventory_hostname]['api_interface'] in hostvars[inventory_hostname]
42+
'ansible_' + hostvars[inventory_hostname]['api_interface'] | replace('-', '_') in hostvars[inventory_hostname]
4343

4444
# NOTE(osmanlicilegi): The distribution might come with cloud-init installed, and manage_etc_hosts
4545
# configuration enabled. If so, it will override the file /etc/hosts from cloud-init templates at
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
fixes:
3+
- |
4+
Fixes an issue when generating ``/etc/hosts`` during ``kolla-ansible
5+
bootstrap-servers`` when one or more hosts has an ``api_interface`` with
6+
dashes (``-``) in its name. `LP#1927357
7+
<https://bugs.launchpad.net/kolla-ansible/+bug/1927357>`__

0 commit comments

Comments
 (0)