Also use enabled_networks

Since we need to generate /etc/hosts on the undercloud as well[1], we
have to use the enabled_networks in addition to role_networks, else we might
lack some entries on the overcloud nodes, namely the internalapi part.

It also makes the generated file a bit less "full of blank", using the
"-" flag in some specific places.

[1] https://review.opendev.org/705634

Change-Id: Ie942e25ed3501cd4988597ea5dd8d1a17eceec67
Related-Bug: #1861782
This commit is contained in:
Cédric Jeanneret 2020-02-06 09:43:46 +01:00 committed by Cédric Jeanneret (Tengu)
parent 109201525f
commit 4697301965
1 changed files with 10 additions and 9 deletions

View File

@ -31,26 +31,27 @@
run_once: true
set_fact:
tripleo_hosts_entries_block: |
{{ tripleo_hosts_entries_undercloud_hosts_entries | join('') }}
{{ tripleo_hosts_entries_undercloud_hosts_entries | default([]) | join('') }}
{{ tripleo_hosts_entries_vip_hosts_entries | join('') }}
{{ tripleo_hosts_entries_vip_hosts_entries | default([]) | join('') }}
{% for host in groups['overcloud'] %}
{% for host in groups['overcloud'] -%}
{{ hostvars[host][hostvars[host]['hostname_resolve_network'] ~ '_ip'] ~ ' ' ~
host ~ '.' ~ cloud_domain ~ ' ' ~ host }}
{% if role_networks is not none %}
{% for network in role_networks | default([]) %}
{% if role_networks is not none -%}
{% set _networks = (enabled_networks | default([])) | union(role_networks | default([])) -%}
{% for network in _networks -%}
{{ hostvars[host][networks[network]['name_lower'] ~ '_ip'] ~ ' ' ~
host ~ '.' ~ network.lower() ~ '.' ~ cloud_domain ~ ' ' ~
host ~ '.' ~ network.lower() }}
{% endfor %}
{% endif %}
{% endfor -%}
{% endif -%}
{{ hostvars[host]['ctlplane_ip'] ~ ' ' ~
host ~ '.ctlplane' ~ '.' ~ cloud_domain ~ ' ' ~ host ~ '.ctlplane' }}
{% endfor %}
{% endfor -%}
{{ tripleo_hosts_entries_extra_hosts_entries | join('') }}
{{ tripleo_hosts_entries_extra_hosts_entries | default([]) | join('') }}
tags:
- tripleo_hosts_entries