Convert a hieradata override to plain t-h-t parameter

Since we're moving the masquerade management out of puppet[1], we
cannot rely on hieradata anymore.

This patch creates a custom_env_file taking care of the override of the
actual heat MasqueradeNetworks parameter.

It also get rid of an ugly pattern, and uses an actual list for the
custom_env_files (while still supporting the space separated string).

[1] https://review.opendev.org/q/topic:masquerade-ansible

Depends-On: https://review.opendev.org/c/openstack/tripleo-ansible/+/836871
Change-Id: I977d245eb4863b37c63e21c416debe8df34b813b
This commit is contained in:
Cédric Jeanneret
2022-04-07 14:00:56 +02:00
parent 78eca4400e
commit aec2975826
5 changed files with 34 additions and 7 deletions

View File

@@ -74,7 +74,8 @@ https://docs.openstack.org/tripleo-quickstart/latest/accessing-libvirt.html
undercloud install CLI. This should only be used to override image prepare
generating this during the undercloud install.
- `undercloud_custom_env_files`: <null> --
A space-separate string for custom t-h-t env files for `undercloud.conf` used with heat installer.
A simple list for custom t-h-t env files for `undercloud.conf` used with heat installer.
For backward compatibility, it also supports space-separate string.
- `undercloud_undercloud_output_dir`: <null> -- allows customize output directory for state, like
downloaded ansible configs and processed heat templates for heat installer
- `undercloud_undercloud_cleanup`: <null> -- controls tear down of the processed heat templates

View File

@@ -79,6 +79,12 @@
dest: "{{ working_dir }}/undercloud-parameter-defaults.yaml"
mode: 0600
- name: Create the undercloud masquerade parameter file.
template:
src: undercloud-masquerade-override.yaml.j2
dest: "{{ working_dir }}/undercloud-parameter-masquerade.yaml"
mode: 0600
- name: Set update_containers_repo if delorean-current is not present
stat:
path: "/etc/yum.repos.d/delorean-current.repo"

View File

@@ -10,11 +10,6 @@ parameter_defaults:
# the value of libvirt_uri into /etc/ironic/ironic.conf.
ironic::drivers::ssh::libvirt_uri: '{{libvirt_uri}}'
{% if ctlplane_masquerade|default(false) %}
# Override masquerading, OVB need's to masquerade the External (10.0.0.0/24) net as well.
tripleo::masquerade_networks::masquerade_networks: {% if overcloud_ipv6|bool %}{'{{ undercloud_network_cidr }}': ['{{ undercloud_network_cidr }}'], '{{ undercloud_external_network_cidr_ipv4 }}': ['{{ undercloud_external_network_cidr_ipv4}}']}{% else %}{'{{ undercloud_network_cidr }}': ['{{ undercloud_network_cidr }}'], '{{ undercloud_external_network_cidr }}': ['{{ undercloud_external_network_cidr}}']}{% endif -%}
{% endif %}
# The following are configurations for the different workers for the undercloud
# services.
{% if undercloud_workers is defined -%}

View File

@@ -0,0 +1,21 @@
---
# Use this as a custom_env_file in the undercloud.conf in order to
# override the MasqueradeNetworks parameter.
# This replaces the old (and soon deprecated) tripleo::masquerade_networks::masquerade_networks
# hieradata override.
{% if ctlplane_masquerade|default(false) %}
# Override masquerading, OVB need's to masquerade the External (10.0.0.0/24) net as well.
parameter_defaults:
MasqueradeNetworks:
{% if overcloud_ipv6|bool %}
'{{ undercloud_network_cidr }}':
- '{{ undercloud_network_cidr }}'
'{{ undercloud_external_network_cidr_ipv4 }}':
- '{{ undercloud_external_network_cidr_ipv4 }}'
{% else %}
'{{ undercloud_network_cidr }}':
- '{{ undercloud_network_cidr }}'
'{{ undercloud_external_network_cidr }}':
- '{{ undercloud_external_network_cidr}}'
{% endif %}
{% endif %}

View File

@@ -352,8 +352,12 @@ container_insecure_registries = {{ local_registry_ip }}:{{ local_registry_port }
#container_insecure_registries =
{% endif %}
{% if undercloud_custom_env_files is defined %}
{% if undercloud_custom_env_files is defined and undercloud_custom_env_files|length > 0 %}
{% if undercloud_custom_env_files is iterable and undercloud_custom_env_files is not string %}
custom_env_files = {{ undercloud_custom_env_files|join(',') }}
{% else %}
custom_env_files = {{ undercloud_custom_env_files.split()|join(',') }}
{% endif %}
{% else %}
#custom_env_files = <None>
{% endif %}