Merge "tripleo_hosts_entries - use hosts_entry global_vars"

This commit is contained in:
Zuul 2021-12-06 15:29:15 +00:00 committed by Gerrit Code Review
commit 26064a28f9
3 changed files with 10 additions and 37 deletions

View File

@ -22,4 +22,4 @@ tripleo_hosts_entries_debug: "{{ (ansible_verbosity | int) >= 2 | bool }}"
tripleo_hosts_entries_hosts_path: /etc/hosts
tripleo_hosts_entries_undercloud_hosts_entries: ""
tripleo_hosts_entries_extra_hosts_entries: ""
tripleo_hosts_entries_vip_hosts_entries: ""
tripleo_hosts_entries_overcloud_hosts_entries: "{{ hosts_entry }}"

View File

@ -39,24 +39,14 @@ provisioner:
# use a tmp hosts path since /etc/hosts isn't writeable in the
# molecule test containers
tripleo_hosts_entries_hosts_path: /tmp/hosts
tripleo_hosts_entries_overcloud_hosts_entries:
- 192.168.24.1 ubi8.localdomain ubi8
- 192.168.24.1 ubi8.ctlplane.localdomain ubi8.ctlplane
- 172.17.0.1 ubi8.internalapi.localdomain ubi8.internalapi
tripleo_hosts_entries_undercloud_hosts_entries: []
tripleo_hosts_entries_extra_hosts_entries: []
tripleo_hosts_entries_vip_hosts_entries: []
tripleo_stack_name: overcloud
plan: overcloud
cloud_domain: localdomain
enabled_networks:
- ctlplane
- InternalApi
role_networks:
- ctlplane
- InternalApi
- DisabledNet
networks:
ctlplane:
name_lower: ctlplane
InternalApi:
name_lower: internal_api
children:
allovercloud:
hosts:

View File

@ -52,21 +52,10 @@
run_once: true
set_fact:
tripleo_hosts_entries_block: |
{% for host in groups['allovercloud'] -%}
{{ hostvars[host][hostvars[host]['hostname_resolve_network'] ~ '_ip'] ~ ' ' ~
host ~ '.' ~ cloud_domain ~ ' ' ~ host }}
{# ## NOTE(hjensas): The Undercloud Minion has no networks, need to check for that here. -#}
{% if hostvars[host]['role_networks'] is not none -%}
{% set _role_networks = hostvars[host]['role_networks'] | default ([]) -%}
{% set _networks = (enabled_networks | default([])) | intersect(_role_networks) -%}
{% for network in _networks -%}
{{ hostvars[host][networks[network]['name_lower'] ~ '_ip'] ~ ' ' ~
host ~ '.' ~ network.lower() ~ '.' ~ cloud_domain ~ ' ' ~
host ~ '.' ~ network.lower() }}
{% endfor -%}
{% endif -%}
{{ hostvars[host]['ctlplane_ip'] ~ ' ' ~
host ~ '.ctlplane' ~ '.' ~ cloud_domain ~ ' ' ~ host ~ '.ctlplane' }}
{% for host in tripleo_hosts_entries_overcloud_hosts_entries | default([]) +
tripleo_hosts_entries_undercloud_hosts_entries | default([]) +
tripleo_hosts_entries_extra_hosts_entries | default([]) %}
{{ host }}
{% endfor %}
tags:
- tripleo_hosts_entries
@ -78,13 +67,7 @@
path: "{{ tripleo_hosts_entries_tmp_hosts.path }}"
# BOF denotes the beginning of the file.
insertbefore: BOF
block: |
{{ tripleo_hosts_entries_block }}
{% for host in tripleo_hosts_entries_undercloud_hosts_entries | default([]) +
tripleo_hosts_entries_vip_hosts_entries | default([]) +
tripleo_hosts_entries_extra_hosts_entries | default([]) %}
{{ host }}
{% endfor %}
block: "{{ tripleo_hosts_entries_block }}"
marker: "# {mark}"
marker_begin: "START_HOST_ENTRIES_FOR_STACK: {{ tripleo_stack_name | default(plan) }}"
marker_end: "END_HOST_ENTRIES_FOR_STACK: {{ tripleo_stack_name | default(plan) }}"