Use Ansible for net_ip_map hieradata

Migrates the net_ip_map hieradata from Heat to the tripleo-hieradata
role.

Detailed changes:
network/ports/port.j2:
  cidr output added for the network subnet cidr of the port
  port for a role
network/ports/noop.yaml:
  cidr output for compatiblity with port template interface
puppet/role.role.j2.yaml:
  {{network.name}}_cidr output added for the each networks subnet cidr
  Remove the net_ip_map hieradata from the per host datafiles generated
  by Heat as tripleo-hieradata template will be used instead.
overcloud.j2.yaml:
  consume cidr outputs from the roles, as well as the ctlplane subnet
  cidr and set them as hieradata vars that get passed into the
  templating process for tripleo-hieradata
common/deploy-steps.j2:
  Add a networks data structure to the global vars setting some needed
  vars for tripleo-heiradata.
  Use the net_ip_map template from tripleo-hieradata

Change-Id: Ib30e8347e1a50efec2b6a97482dc98c383cb7cf7
Depends-On: Iaec3654900f250eacf39c7748df166b716937358
This commit is contained in:
James Slagle 2019-07-02 09:20:20 -04:00 committed by Emilien Macchi
parent 6a11e0c5c7
commit 27e7005ad4
5 changed files with 35 additions and 2 deletions

View File

@ -345,6 +345,12 @@ outputs:
net_vip_map: {get_param: NetVipMap}
{%- for network in networks if network.enabled|default(true) %}
{{network.name_lower}}_net_name: {get_param: {{network.name}}NetName}
{%- endfor %}
networks:
{%- for network in networks if network.enabled|default(true) %}
{{network.name}}:
name: {get_param: {{network.name}}NetName}
name_lower: {{ network.name_lower }}
{%- endfor %}
network_virtual_ips:
ctlplane:
@ -531,6 +537,7 @@ outputs:
- bootstrap_node
- all_nodes
- vip_data
- net_ip_map
when: tripleo_role_name == '{{role.name}}'
tags:
- overcloud

View File

@ -85,3 +85,6 @@ outputs:
gateway_ip: # Here for compatibility
description: Gateway IP of the ports subnet
value: ''
cidr:
description: CIDR of the ports subnet
value: {get_param: ControlPlaneSubnetCidr}

View File

@ -109,4 +109,8 @@ outputs:
gateway_ip:
description: Gateway IP of the ports subnet
value:
get_attr: [{{network.name}}Port, subnets, 0, gateway_ip]
get_attr: [{{network.name}}Port, subnets, 0, gateway_ip]
cidr:
description: CIDR of the ports subnet
value:
str_split: ['/', {get_attr: [{{network.name}}Port, subnets, 0, cidr]}, 1]

View File

@ -771,6 +771,20 @@ resources:
yaql:
expression: coalesce($.data, []).first(null)
data: {get_attr: [{{outer_role.name}}, hostname]}
ctlplane_subnet_cidr:
if:
- ctlplane_subnet_cidr_set
- {get_param: ControlPlaneSubnetCidr}
- {str_split: ['/', {get_attr: [ControlVirtualIP, subnets, 0, cidr]}, 1]}
network_cidrs:
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in outer_role.networks|default([]) %}
{{network.name}}_cidr:
yaql:
expression: switch(isList($.data) and $.data.len() > 0 => $.data[0], true => "")
data: {get_attr: [{{outer_role.name}}, {{network.name}}_cidr]}
{%- endif %}
{%- endfor %}
{%- endfor %}
GlobalConfig:

View File

@ -753,7 +753,6 @@ resources:
value:
datafiles:
host_extraconfig: {get_attr: [{{server_resource_name}}AnsibleHostVars, value]}
net_ip_map: {get_attr: [NetIpMap, net_ip_map]}
outputs:
@ -890,3 +889,9 @@ outputs:
neutron_physical_bridge_name: {get_param: NeutronPhysicalBridge}
neutron_public_interface_name: {get_param: NeutronPublicInterface}
network_deployment_actions: {get_attr: [NetworkDeploymentActionsValue, value]}
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}_cidr:
value: {get_attr: [{{network.name}}Port, cidr]}
{%- endif %}
{%- endfor %}