From 3f27375920b0ac2ffcba975f95f54a5f3aa7be76 Mon Sep 17 00:00:00 2001 From: James Slagle Date: Tue, 5 Nov 2019 09:08:51 -0500 Subject: [PATCH] Fix network hostnames in tripleo-hosts-entries The previous Heat behavior used the jinja2 lower() filter on the network name to create the hostnames, not network.name_lower. As network.name_lower can container underscores, this was causing an issue since the expected hostnames were not present in /etc/hosts. This patch corrects the issue by switching to just using the lower() filter. Change-Id: Ia02ca1263590e2b579f2534e99119d7b1cd4b39a --- .../roles/tripleo-hosts-entries/molecule/default/verify.yml | 4 ++-- tripleo_ansible/roles/tripleo-hosts-entries/tasks/main.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tripleo_ansible/roles/tripleo-hosts-entries/molecule/default/verify.yml b/tripleo_ansible/roles/tripleo-hosts-entries/molecule/default/verify.yml index 61a4c192f..fbdc36d24 100644 --- a/tripleo_ansible/roles/tripleo-hosts-entries/molecule/default/verify.yml +++ b/tripleo_ansible/roles/tripleo-hosts-entries/molecule/default/verify.yml @@ -28,10 +28,10 @@ loop: - 192.168.24.2 centos7.localdomain centos7 - 192.168.24.2 centos7.ctlplane.localdomain centos7.ctlplane - - 172.17.0.2 centos7.internal_api.localdomain centos7.internal_api + - 172.17.0.2 centos7.internalapi.localdomain centos7.internalapi - 192.168.24.1 centos8.localdomain centos8 - 192.168.24.1 centos8.ctlplane.localdomain centos8.ctlplane - - 172.17.0.1 centos8.internal_api.localdomain centos8.internal_api + - 172.17.0.1 centos8.internalapi.localdomain centos8.internalapi - name: slurp /tmp/hosts slurp: diff --git a/tripleo_ansible/roles/tripleo-hosts-entries/tasks/main.yml b/tripleo_ansible/roles/tripleo-hosts-entries/tasks/main.yml index 3cb975c32..bcae0eb8a 100644 --- a/tripleo_ansible/roles/tripleo-hosts-entries/tasks/main.yml +++ b/tripleo_ansible/roles/tripleo-hosts-entries/tasks/main.yml @@ -43,8 +43,8 @@ {% if role_networks is not none %} {% for network in role_networks | default([]) %} {{ hostvars[host][networks[network]['name_lower'] ~ '_ip'] ~ ' ' ~ - host ~ '.' ~ networks[network]['name_lower'] ~ '.' ~ cloud_domain ~ ' ' ~ - host ~ '.' ~ networks[network]['name_lower'] }} + host ~ '.' ~ network.lower() ~ '.' ~ cloud_domain ~ ' ' ~ + host ~ '.' ~ network.lower() }} {% endfor %} {% endif %} {{ hostvars[host]['ctlplane_ip'] ~ ' ' ~