Add local_address to the default hieradata on all hosts

This change will ensure a local_address is always defined within our
generated hieradata. This change imports existing logic into our config
to ensure that the value of the local_address matches our expected
values. We ensure compatibility with legacy installs by inspecting if a
host has IPv6 enabled on the loopback device. In the event that IPv6 is
enabled, the value of local_address will be set to "localhost" otherwise
it will defined as "127.0.0.1".

Closes-Bug: 1843422
Change-Id: I20e69315bacdded4bc2d5b47e18609f130f8abc5
Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
Kevin Carter 2019-09-12 16:15:55 -05:00
parent 1b6703e5e5
commit 6338056938
2 changed files with 8 additions and 0 deletions

View File

@ -52,3 +52,7 @@ hieradata_templates_list:
- bootstrap_node
- all_nodes
- vip_data
# define a local address. If the ipv6 is found to be enable on the
# loopback device the local address will be set to "localhost" otherwise
# the local address will be defined as "127.0.0.1".
hieradata_localhost_address: "{{ ('ipv6' in (ansible_lo | default({}))) | ternary('localhost', '127.0.0.1') }}"

View File

@ -41,6 +41,10 @@
{% if 'ovn_dbs' in enabled_services and net_vip_map.ovn_dbs is defined %}
{% set _ = all_nodes.__setitem__('ovn_dbs_vip', (net_vip_map.ovn_dbs)) %}
{% endif %}
{% if hieradata_localhost_address is undefined %}
{% set hieradata_localhost_address = ('ipv6' in (ansible_lo | default({}))) | ternary('localhost', '127.0.0.1') %}
{% endif %}
{% set _ = all_nodes.__setitem__('localhost_address', hieradata_localhost_address) %}
{% set _ = all_nodes.__setitem__('deploy_identifier', deploy_identifier) %}
{% set _ = all_nodes.__setitem__('stack_action', stack_action) %}
{% set _ = all_nodes.__setitem__('stack_update_type', stack_update_type) %}