Skip templating disabled networks

Ignore disabled networks when rendering templates.

Add's the ctlplane network to maps to ensure we don't
end up with no keys/values in map_replace functions.

Also some Jinja cleanup:
 - Reduce the number of times we iterate over networks
   where we can.
 - Add's indentation to make the code easier to read.

Related-Bug: #1809313
Depends-On: I2e8135bc9389d3bf1a6ef01e273515af5c488a9a
Change-Id: Ifeb2d2d1acb43c16a5bf29e95965776494d61fef
This commit is contained in:
Harald Jensås 2019-01-02 13:11:46 +01:00
parent 9525423f7b
commit 53027484ae
11 changed files with 173 additions and 185 deletions

View File

@ -8,7 +8,7 @@ parameters:
description: Cidrs for the ctlplane network. description: Cidrs for the ctlplane network.
resources: resources:
{%- for network in networks %} {%- for network in networks if network.enabled|default(true) %}
{%- set network_name = network.compat_name|default(network.name) %} {%- set network_name = network.compat_name|default(network.name) %}
{{network_name}}Network: {{network_name}}Network:
type: OS::TripleO::Network::{{network.name}} type: OS::TripleO::Network::{{network.name}}
@ -23,7 +23,7 @@ outputs:
value: value:
# NOTE(hjensas): If a network does not have any network_cidrs, fall back # NOTE(hjensas): If a network does not have any network_cidrs, fall back
# to the ctlplane (provisioning) network. # to the ctlplane (provisioning) network.
{%- for network in networks %} {%- for network in networks if network.enabled|default(true) %}
{%- set network_name = network.compat_name|default(network.name) %} {%- set network_name = network.compat_name|default(network.name) %}
{{network.name_lower}}: {{network.name_lower}}:
yaql: yaql:

View File

@ -4,10 +4,14 @@ parameters:
ControlPlaneIpList: ControlPlaneIpList:
default: [] default: []
type: comma_delimited_list type: comma_delimited_list
{%- for network in networks %} {%- for network in networks if network.enabled|default(true) %}
{{network.name}}IpList: {{network.name}}IpList:
default: [] default: []
type: comma_delimited_list type: comma_delimited_list
{{network.name}}NetName:
default: {{network.name_lower}}
description: The name of the {{network.name_lower}} network.
type: string
{%- endfor %} {%- endfor %}
EnabledServices: EnabledServices:
default: [] default: []
@ -21,12 +25,6 @@ parameters:
NetworkHostnameMap: NetworkHostnameMap:
default: [] default: []
type: json type: json
{%- for network in networks %}
{{network.name}}NetName:
default: {{network.name_lower}}
description: The name of the {{network.name_lower}} network.
type: string
{%- endfor %}
resources: resources:
@ -59,11 +57,12 @@ resources:
value: value:
map_replace: map_replace:
- ctlplane: {get_param: ControlPlaneIpList} - ctlplane: {get_param: ControlPlaneIpList}
{%- for network in networks %} {%- for network in networks if network.enabled|default(true) %}
{{network.name_lower}}: {get_param: {{network.name}}IpList} {{network.name_lower}}: {get_param: {{network.name}}IpList}
{%- endfor %} {%- endfor %}
- keys: - keys:
{%- for network in networks %} ctlplane: ctlplane # Ensure one key is present, in case no enabled networks
{%- for network in networks if network.enabled|default(true) %}
{{network.name_lower}}: {get_param: {{network.name}}NetName} {{network.name_lower}}: {get_param: {{network.name}}NetName}
{%- endfor %} {%- endfor %}

View File

@ -10,7 +10,7 @@ parameters:
The subnet CIDR of the control plane network. (The parameter is The subnet CIDR of the control plane network. (The parameter is
automatically resolved from the ctlplane subnet's cidr attribute.) automatically resolved from the ctlplane subnet's cidr attribute.)
type: string type: string
{%- for network in networks %} {%- for network in networks if network.enabled|default(true) %}
{{network.name}}Ip: {{network.name}}Ip:
default: '' default: ''
type: string type: string
@ -22,9 +22,6 @@ parameters:
default: '' default: ''
type: string type: string
description: IP address with brackets in case of IPv6 description: IP address with brackets in case of IPv6
{%- endfor %}
{%- for network in networks %}
{{network.name}}NetName: {{network.name}}NetName:
default: {{network.name_lower}} default: {{network.name_lower}}
description: The name of the {{network.name_lower}} network. description: The name of the {{network.name_lower}} network.
@ -40,34 +37,27 @@ resources:
value: value:
map_replace: map_replace:
- ctlplane: {get_param: ControlPlaneIp} - ctlplane: {get_param: ControlPlaneIp}
{%- for network in networks %}
{{network.name_lower}}: {get_param: {{network.name}}Ip}
{%- endfor %}
ctlplane_subnet: ctlplane_subnet:
list_join: list_join:
- '' - ''
- - {get_param: ControlPlaneIp} - - {get_param: ControlPlaneIp}
- '/' - '/'
- {get_param: ControlPlaneSubnetCidr} - {get_param: ControlPlaneSubnetCidr}
{%- for network in networks %}
{{network.name_lower}}_subnet: {get_param: {{network.name}}IpSubnet}
{%- endfor %}
ctlplane_uri: {get_param: ControlPlaneIp} ctlplane_uri: {get_param: ControlPlaneIp}
{%- for network in networks %} {%- for network in networks if network.enabled|default(true) %}
{{network.name_lower}}: {get_param: {{network.name}}Ip}
{{network.name_lower}}_subnet: {get_param: {{network.name}}IpSubnet}
{{network.name_lower}}_uri: {get_param: {{network.name}}IpUri} {{network.name_lower}}_uri: {get_param: {{network.name}}IpUri}
{%- endfor %} {%- endfor %}
- keys: - keys:
{%- for network in networks %} ctlplane: ctlplane # Ensure one key is present, in case no enabled networks
{%- for network in networks if network.enabled|default(true) %}
{{network.name_lower}}: {get_param: {{network.name}}NetName} {{network.name_lower}}: {get_param: {{network.name}}NetName}
{%- endfor %}
{%- for network in networks %}
{{network.name_lower}}_subnet: {{network.name_lower}}_subnet:
str_replace: str_replace:
template: NAME_subnet template: NAME_subnet
params: params:
NAME: {get_param: {{network.name}}NetName} NAME: {get_param: {{network.name}}NetName}
{%- endfor %}
{%- for network in networks %}
{{network.name_lower}}_uri: {{network.name_lower}}_uri:
str_replace: str_replace:
template: NAME_uri template: NAME_uri

View File

@ -5,7 +5,7 @@ parameters:
ControlPlaneIP: ControlPlaneIP:
default: '' default: ''
type: string type: string
{%- for network in networks if network.vip|default(false) %} {%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
{{network.name}}NetworkVip: {{network.name}}NetworkVip:
default: '' default: ''
type: string type: string
@ -14,7 +14,7 @@ parameters:
ControlPlaneIp: ControlPlaneIp:
default: '' default: ''
type: string type: string
{%- for network in networks if network.vip|default(false) %} {%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
{{network.name}}Ip: {{network.name}}Ip:
default: '' default: ''
type: string type: string
@ -31,10 +31,8 @@ outputs:
for a specific machine. for a specific machine.
value: value:
ctlplane: {get_param: ControlPlaneIP} ctlplane: {get_param: ControlPlaneIP}
{%- for network in networks if network.vip|default(false) %}
{{network.name_lower}}: {get_param: {{network.name}}NetworkVip}
{%- endfor %}
ctlplane_uri: {get_param: ControlPlaneIP} ctlplane_uri: {get_param: ControlPlaneIP}
{%- for network in networks if network.vip|default(false) %} {%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
{{network.name_lower}}: {get_param: {{network.name}}NetworkVip}
{{network.name_lower}}_uri: {get_param: {{network.name}}NetworkVip} {{network.name_lower}}_uri: {get_param: {{network.name}}NetworkVip}
{%- endfor %} {%- endfor %}

View File

@ -5,7 +5,7 @@ parameters:
ControlPlaneIP: ControlPlaneIP:
default: '' default: ''
type: string type: string
{%- for network in networks if network.vip|default(false) %} {%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
{{network.name}}NetworkVip: {{network.name}}NetworkVip:
default: '' default: ''
type: string type: string
@ -14,7 +14,7 @@ parameters:
ControlPlaneIp: ControlPlaneIp:
default: '' default: ''
type: string type: string
{%- for network in networks if network.vip|default(false) %} {%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
{{network.name}}Ip: {{network.name}}Ip:
default: '' default: ''
type: string type: string
@ -31,11 +31,9 @@ outputs:
for a specific machine. for a specific machine.
value: value:
ctlplane: {get_param: ControlPlaneIP} ctlplane: {get_param: ControlPlaneIP}
{%- for network in networks if network.vip|default(false) %}
{{network.name_lower}}: {get_param: {{network.name}}NetworkVip}
{%- endfor %}
ctlplane_uri: {get_param: ControlPlaneIP} ctlplane_uri: {get_param: ControlPlaneIP}
{%- for network in networks if network.vip|default(false) %} {%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
{{network.name_lower}}: {get_param: {{network.name}}NetworkVip}
{{network.name_lower}}_uri: {{network.name_lower}}_uri:
list_join: list_join:
- '' - ''

View File

@ -149,7 +149,7 @@ parameters:
internal use only, this will be removed in future. internal use only, this will be removed in future.
type: json type: json
{%- for network in networks %} {%- for network in networks if network.enabled|default(true) %}
{{network.name}}NetName: {{network.name}}NetName:
default: {{network.name_lower}} default: {{network.name_lower}}
description: The name of the {{network.name_lower}} network. description: The name of the {{network.name_lower}} network.
@ -172,7 +172,7 @@ resources:
- map_replace: - map_replace:
- {get_param: ServiceNetMapDefaults} - {get_param: ServiceNetMapDefaults}
- values: - values:
{%- for network in networks %} {%- for network in networks if network.enabled|default(true) %}
{%- if network.service_net_map_replace is defined %} {%- if network.service_net_map_replace is defined %}
{{network.service_net_map_replace}}: {{network.name_lower}} {{network.service_net_map_replace}}: {{network.name_lower}}
{%- else %} {%- else %}

View File

@ -23,7 +23,7 @@ resource_registry:
OS::TripleO::Tasks::{{role.name}}PostConfig: OS::Heat::None OS::TripleO::Tasks::{{role.name}}PostConfig: OS::Heat::None
OS::TripleO::{{role.name}}ExtraConfigPre: puppet/extraconfig/pre_deploy/default.yaml OS::TripleO::{{role.name}}ExtraConfigPre: puppet/extraconfig/pre_deploy/default.yaml
# Port assignments for the {{role.name}} role # Port assignments for the {{role.name}} role
{%- for network in networks %} {%- for network in networks if network.enabled|default(true) and network.name in role.networks|default([]) %}
OS::TripleO::{{role.name}}::Ports::{{network.name}}Port: network/ports/noop.yaml OS::TripleO::{{role.name}}::Ports::{{network.name}}Port: network/ports/noop.yaml
{%- endfor %} {%- endfor %}
OS::TripleO::{{role.name}}::Net::SoftwareConfig: net-config-noop.yaml OS::TripleO::{{role.name}}::Net::SoftwareConfig: net-config-noop.yaml
@ -69,7 +69,7 @@ resource_registry:
# TripleO overcloud networks # TripleO overcloud networks
OS::TripleO::Network: network/networks.yaml OS::TripleO::Network: network/networks.yaml
{%- for network in networks %} {%- for network in networks if network.enabled|default(true) %}
OS::TripleO::Network::{{network.name}}: OS::Heat::None OS::TripleO::Network::{{network.name}}: OS::Heat::None
{%- endfor %} {%- endfor %}
@ -80,7 +80,7 @@ resource_registry:
OS::TripleO::Network::Ports::NetIpListMap: network/ports/net_ip_list_map.yaml OS::TripleO::Network::Ports::NetIpListMap: network/ports/net_ip_list_map.yaml
# Port assignments for the VIPs # Port assignments for the VIPs
{%- for network in networks if network.vip|default(false) %} {%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
OS::TripleO::Network::Ports::{{network.name}}VipPort: network/ports/noop.yaml OS::TripleO::Network::Ports::{{network.name}}VipPort: network/ports/noop.yaml
{%- endfor %} {%- endfor %}

View File

@ -20,15 +20,22 @@ description: >
# some order in here. # some order in here.
parameters: parameters:
# Common parameters (not specific to a role) # Common parameters (not specific to
{%- for network in networks if network.vip|default(false) %} {%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
{%- if network.name == 'External' %} {%- if network.name == 'External' %}
# Special case the External hostname param, which is CloudName # Special case the External hostname param, which is CloudName
CloudName: CloudName:
default: overcloud.localdomain default: overcloud.localdomain
description: The DNS name of this cloud. E.g. ci-overcloud.tripleo.org description: The DNS name of this cloud. E.g. ci-overcloud.tripleo.org
type: string type: string
{%- elif network.name == 'InternalApi' %} # TODO (dsneddon) Legacy name, eventually refactor to match network name
PublicVirtualFixedIPs:
default: []
description: >
Control the IP allocation for the PublicVirtualInterface port. E.g.
[{'ip_address':'1.2.3.4'}]
type: json
{%- elif network.name == 'InternalApi' %}
# Special case the Internal API hostname param, which is CloudNameInternal # Special case the Internal API hostname param, which is CloudNameInternal
CloudNameInternal: CloudNameInternal:
default: overcloud.{{network.name.lower()}}.localdomain default: overcloud.{{network.name.lower()}}.localdomain
@ -36,7 +43,7 @@ parameters:
The DNS name of this cloud's {{network.name_lower}} endpoint. E.g. The DNS name of this cloud's {{network.name_lower}} endpoint. E.g.
'ci-overcloud.{{network.name.lower()}}.tripleo.org'. 'ci-overcloud.{{network.name.lower()}}.tripleo.org'.
type: string type: string
{%- elif network.name == 'StorageMgmt' %} {%- elif network.name == 'StorageMgmt' %}
# Special case StorageMgmt hostname param, which is CloudNameStorageManagement # Special case StorageMgmt hostname param, which is CloudNameStorageManagement
CloudNameStorageManagement: CloudNameStorageManagement:
default: overcloud.{{network.name.lower()}}.localdomain default: overcloud.{{network.name.lower()}}.localdomain
@ -44,14 +51,20 @@ parameters:
The DNS name of this cloud's {{network.name_lower}} endpoint. E.g. The DNS name of this cloud's {{network.name_lower}} endpoint. E.g.
'ci-overcloud.{{network.name.lower()}}.tripleo.org'. 'ci-overcloud.{{network.name.lower()}}.tripleo.org'.
type: string type: string
{%- else %} {%- else %}
CloudName{{network.name}}: CloudName{{network.name}}:
default: overcloud.{{network.name.lower()}}.localdomain default: overcloud.{{network.name.lower()}}.localdomain
description: > description: >
The DNS name of this cloud's {{network.name_lower}} endpoint. E.g. The DNS name of this cloud's {{network.name_lower}} endpoint. E.g.
'ci-overcloud.{{network.name.lower()}}.tripleo.org'. 'ci-overcloud.{{network.name.lower()}}.tripleo.org'.
type: string type: string
{%- endif %} {%- endif %}
{{network.name}}VirtualFixedIPs:
default: []
description: >
Control the IP allocation for the {{network.name}}VirtualInterface port. E.g.
[{'ip_address':'1.2.3.4'}]
type: json
{%- endfor %} {%- endfor %}
CloudNameCtlplane: CloudNameCtlplane:
default: overcloud.ctlplane.localdomain default: overcloud.ctlplane.localdomain
@ -72,20 +85,6 @@ parameters:
description: | description: |
Additional hiera configuration to inject into the cluster. Additional hiera configuration to inject into the cluster.
type: json type: json
{%- for role in roles %}
{{role.name}}ExtraConfig:
default: {}
description: |
Role specific additional hiera configuration to inject into the cluster.
type: json
{%- if role.deprecated_param_extraconfig is defined %}
{{role.deprecated_param_extraconfig}}:
default: {}
description: |
DEPRECATED use {{role.name}}ExtraConfig instead
type: json
{%- endif %}
{%- endfor %}
NeutronControlPlaneID: NeutronControlPlaneID:
default: 'ctlplane' default: 'ctlplane'
type: string type: string
@ -110,21 +109,6 @@ parameters:
Control the IP allocation for the ControlVirtualIP port. E.g. Control the IP allocation for the ControlVirtualIP port. E.g.
[{'ip_address':'1.2.3.4'}] [{'ip_address':'1.2.3.4'}]
type: json type: json
# TODO (dsneddon) Legacy name, eventually refactor to match network name
PublicVirtualFixedIPs:
default: []
description: >
Control the IP allocation for the PublicVirtualInterface port. E.g.
[{'ip_address':'1.2.3.4'}]
type: json
{%- for network in networks if network.vip|default(false) and network.name != 'External' %}
{{network.name}}VirtualFixedIPs:
default: []
description: >
Control the IP allocation for the {{network.name}}VirtualInterface port. E.g.
[{'ip_address':'1.2.3.4'}]
type: json
{%- endfor %}
RabbitCookieSalt: RabbitCookieSalt:
type: string type: string
default: unset default: unset
@ -169,6 +153,18 @@ parameters:
# Jinja loop for Role in role_data.yaml # Jinja loop for Role in role_data.yaml
{% for role in roles %} {% for role in roles %}
{{role.name}}ExtraConfig:
default: {}
description: |
Role specific additional hiera configuration to inject into the cluster.
type: json
{%- if role.deprecated_param_extraconfig is defined %}
{{role.deprecated_param_extraconfig}}:
default: {}
description: |
DEPRECATED use {{role.name}}ExtraConfig instead
type: json
{%- endif %}
# Parameters generated for {{role.name}} Role # Parameters generated for {{role.name}} Role
{{role.name}}Services: {{role.name}}Services:
description: A list of service resources (configured in the Heat description: A list of service resources (configured in the Heat
@ -298,35 +294,35 @@ resources:
params: params:
IP: {get_attr: [VipMap, net_ip_map, ctlplane]} IP: {get_attr: [VipMap, net_ip_map, ctlplane]}
HOST: {get_param: CloudNameCtlplane} HOST: {get_param: CloudNameCtlplane}
{%- for network in networks if network.vip|default(false) %} {%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
{%- if network.name == 'External' %} {%- if network.name == 'External' %}
# Special case the External hostname param, which is CloudName # Special case the External hostname param, which is CloudName
- str_replace: - str_replace:
template: IP HOST template: IP HOST
params: params:
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]} IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
HOST: {get_param: CloudName} HOST: {get_param: CloudName}
{%- elif network.name == 'InternalApi' %} {%- elif network.name == 'InternalApi' %}
# Special case the Internal API hostname param, which is CloudNameInternal # Special case the Internal API hostname param, which is CloudNameInternal
- str_replace: - str_replace:
template: IP HOST template: IP HOST
params: params:
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]} IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
HOST: {get_param: CloudNameInternal} HOST: {get_param: CloudNameInternal}
{%- elif network.name == 'StorageMgmt' %} {%- elif network.name == 'StorageMgmt' %}
# Special case StorageMgmt hostname param, which is CloudNameStorageManagement # Special case StorageMgmt hostname param, which is CloudNameStorageManagement
- str_replace: - str_replace:
template: IP HOST template: IP HOST
params: params:
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]} IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
HOST: {get_param: CloudNameStorageManagement} HOST: {get_param: CloudNameStorageManagement}
{%- else %} {%- else %}
- str_replace: - str_replace:
template: IP HOST template: IP HOST
params: params:
IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]} IP: {get_attr: [VipMap, net_ip_map, {{network.name_lower}}]}
HOST: {get_param: CloudName{{network.name}}} HOST: {get_param: CloudName{{network.name}}}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
HeatAuthEncryptionKey: HeatAuthEncryptionKey:
@ -364,19 +360,19 @@ resources:
properties: properties:
CloudEndpoints: CloudEndpoints:
ctlplane: {get_param: CloudNameCtlplane} ctlplane: {get_param: CloudNameCtlplane}
{%- for network in networks if network.vip|default(false) %} {%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
{%- if network.name == 'External' %} {%- if network.name == 'External' %}
# Special case the External hostname param, which is CloudName # Special case the External hostname param, which is CloudName
{{network.name_lower}}: {get_param: CloudName} {{network.name_lower}}: {get_param: CloudName}
{%- elif network.name == 'InternalApi' %} {%- elif network.name == 'InternalApi' %}
# Special case the Internal API hostname param, which is CloudNameInternal # Special case the Internal API hostname param, which is CloudNameInternal
{{network.name_lower}}: {get_param: CloudNameInternal} {{network.name_lower}}: {get_param: CloudNameInternal}
{%- elif network.name == 'StorageMgmt' %} {%- elif network.name == 'StorageMgmt' %}
# Special case StorageMgmt hostname param, which is CloudNameStorageManagement # Special case StorageMgmt hostname param, which is CloudNameStorageManagement
{{network.name_lower}}: {get_param: CloudNameStorageManagement} {{network.name_lower}}: {get_param: CloudNameStorageManagement}
{%- else %} {%- else %}
{{network.name_lower}}: {get_param: CloudName{{network.name}}} {{network.name_lower}}: {get_param: CloudName{{network.name}}}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
NetIpMap: {get_attr: [VipMap, net_ip_map]} NetIpMap: {get_attr: [VipMap, net_ip_map]}
ServiceNetMap: {get_attr: [ServiceNetMap, service_net_map]} ServiceNetMap: {get_attr: [ServiceNetMap, service_net_map]}
@ -485,9 +481,9 @@ resources:
map_merge: map_merge:
- get_attr: [{{role.name}}ServiceConfigSettings, value] - get_attr: [{{role.name}}ServiceConfigSettings, value]
- get_param: ExtraConfig - get_param: ExtraConfig
{%- if role.deprecated_param_extraconfig is defined %} {%- if role.deprecated_param_extraconfig is defined %}
- get_param: {{role.deprecated_param_extraconfig}} - get_param: {{role.deprecated_param_extraconfig}}
{%- endif %} {%- endif %}
- get_param: {{role.name}}ExtraConfig - get_param: {{role.name}}ExtraConfig
# Filter any null/None service_names which may be present due to mapping # Filter any null/None service_names which may be present due to mapping
@ -519,10 +515,10 @@ resources:
{{role.name}}AllNodesDeployment: {{role.name}}AllNodesDeployment:
type: OS::TripleO::AllNodesDeployment type: OS::TripleO::AllNodesDeployment
depends_on: depends_on:
{% for role_inner in roles %} {%- for role_inner in roles %}
- {{role_inner.name}}HostsDeployment - {{role_inner.name}}HostsDeployment
- {{role_inner.name}}SshKnownHostsDeployment - {{role_inner.name}}SshKnownHostsDeployment
{% endfor %} {%- endfor %}
properties: properties:
name: {{role.name}}AllNodesDeployment name: {{role.name}}AllNodesDeployment
config: {get_attr: [allNodesConfig, config_id]} config: {get_attr: [allNodesConfig, config_id]}
@ -550,13 +546,13 @@ resources:
type: OS::TripleO::Network::Ports::NetIpListMap type: OS::TripleO::Network::Ports::NetIpListMap
properties: properties:
ControlPlaneIpList: {get_attr: [{{role.name}}, ip_address]} ControlPlaneIpList: {get_attr: [{{role.name}}, ip_address]}
{%- for network in networks %} {%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %} {%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
{{network.name}}IpList: {get_attr: [{{role.name}}, {{network.name_lower}}_ip_address]} {{network.name}}IpList: {get_attr: [{{role.name}}, {{network.name_lower}}_ip_address]}
{%- else %} {%- else %}
{{network.name}}IpList: {get_attr: [{{role.name}}, ip_address]} {{network.name}}IpList: {get_attr: [{{role.name}}, ip_address]}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
EnabledServices: {get_attr: [{{role.name}}ServiceNames, value]} EnabledServices: {get_attr: [{{role.name}}ServiceNames, value]}
ServiceNetMap: {get_attr: [ServiceNetMap, service_net_map_lower]} ServiceNetMap: {get_attr: [ServiceNetMap, service_net_map_lower]}
ServiceHostnameList: {get_attr: [{{role.name}}, hostname]} ServiceHostnameList: {get_attr: [{{role.name}}, hostname]}
@ -618,9 +614,9 @@ resources:
# nested template, as it can contain %index% # nested template, as it can contain %index%
{{role.name}}SchedulerHints: {{role.name}}SchedulerHints:
map_merge: map_merge:
{%- if role.deprecated_param_scheduler_hints is defined %} {%- if role.deprecated_param_scheduler_hints is defined %}
- {get_param: {{role.deprecated_param_scheduler_hints}}} - {get_param: {{role.deprecated_param_scheduler_hints}}}
{%- endif %} {%- endif %}
- {get_param: {{role.name}}SchedulerHints} - {get_param: {{role.name}}SchedulerHints}
ServiceConfigSettings: {get_attr: [{{role.name}}ServiceConfigSettings, value]} ServiceConfigSettings: {get_attr: [{{role.name}}ServiceConfigSettings, value]}
ServiceNames: {get_attr: [{{role.name}}ServiceNames, value]} ServiceNames: {get_attr: [{{role.name}}ServiceNames, value]}
@ -632,9 +628,9 @@ resources:
- {{role.RoleParametersDefault|default({})}} - {{role.RoleParametersDefault|default({})}}
- get_param: {{role.name}}Parameters - get_param: {{role.name}}Parameters
UserData: {get_resource: {{role.name}}UserData} UserData: {get_resource: {{role.name}}UserData}
{% endfor %} {%- endfor %}
{% for role in roles %} {%- for role in roles %}
{{role.name}}Servers: {{role.name}}Servers:
type: OS::Heat::Value type: OS::Heat::Value
depends_on: {{role.name}} depends_on: {{role.name}}
@ -645,7 +641,7 @@ resources:
expression: let(servers=>switch(isDict($.data.servers) => $.data.servers, true => {})) -> $servers.deleteAll($servers.keys().where($servers[$] = null)) expression: let(servers=>switch(isDict($.data.servers) => $.data.servers, true => {})) -> $servers.deleteAll($servers.keys().where($servers[$] = null))
data: data:
servers: {get_attr: [{{role.name}}, attributes, nova_server_resource]} servers: {get_attr: [{{role.name}}, attributes, nova_server_resource]}
{% endfor %} {%- endfor %}
# This is a different format to *Servers, as it creates a map of lists # This is a different format to *Servers, as it creates a map of lists
# whereas *Servers creates a map of maps with keys of the nested resource names # whereas *Servers creates a map of maps with keys of the nested resource names
@ -654,9 +650,9 @@ resources:
properties: properties:
value: value:
server_ids: server_ids:
{% for role in roles %} {%- for role in roles %}
{{role.name}}: {get_attr: [{{role.name}}, nova_server_resource]} {{role.name}}: {get_attr: [{{role.name}}, nova_server_resource]}
{% endfor %} {%- endfor %}
bootstrap_server_id: bootstrap_server_id:
yaql: yaql:
expression: coalesce($.data, []).first(null) expression: coalesce($.data, []).first(null)
@ -690,37 +686,37 @@ resources:
- {get_attr: [VipHosts, value]} - {get_attr: [VipHosts, value]}
- '' - ''
- -
{% for role in roles %} {%- for role in roles %}
- list_join: - list_join:
- "" - ""
- {get_attr: [{{role.name}}, hosts_entry]} - {get_attr: [{{role.name}}, hosts_entry]}
{% endfor %} {%- endfor %}
- {get_param: ExtraHostFileEntries} - {get_param: ExtraHostFileEntries}
allNodesConfig: allNodesConfig:
type: OS::TripleO::AllNodes::SoftwareConfig type: OS::TripleO::AllNodes::SoftwareConfig
properties: properties:
{%- for network in networks if network.vip|default(false) %} {%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
{%- if network.name == 'External' %} {%- if network.name == 'External' %}
# Special case the External hostname param, which is CloudName # Special case the External hostname param, which is CloudName
cloud_name_{{network.name_lower}}: {get_param: CloudName} cloud_name_{{network.name_lower}}: {get_param: CloudName}
{%- elif network.name == 'InternalApi' %} {%- elif network.name == 'InternalApi' %}
# Special case the Internal API hostname param, which is CloudNameInternal # Special case the Internal API hostname param, which is CloudNameInternal
cloud_name_{{network.name_lower}}: {get_param: CloudNameInternal} cloud_name_{{network.name_lower}}: {get_param: CloudNameInternal}
{%- elif network.name == 'StorageMgmt' %} {%- elif network.name == 'StorageMgmt' %}
# Special case StorageMgmt hostname param, which is CloudNameStorageManagement # Special case StorageMgmt hostname param, which is CloudNameStorageManagement
cloud_name_{{network.name_lower}}: {get_param: CloudNameStorageManagement} cloud_name_{{network.name_lower}}: {get_param: CloudNameStorageManagement}
{%- else %} {%- else %}
cloud_name_{{network.name_lower}}: {get_param: CloudName{{network.name}}} cloud_name_{{network.name_lower}}: {get_param: CloudName{{network.name}}}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
cloud_name_ctlplane: {get_param: CloudNameCtlplane} cloud_name_ctlplane: {get_param: CloudNameCtlplane}
enabled_services: enabled_services:
list_join: list_join:
- ',' - ','
{% for role in roles %} {%- for role in roles %}
- {get_attr: [{{role.name}}ServiceNames, value]} - {get_attr: [{{role.name}}ServiceNames, value]}
{% endfor %} {%- endfor %}
controller_ips: {get_attr: [{{primary_role_name}}, ip_address]} controller_ips: {get_attr: [{{primary_role_name}}, ip_address]}
controller_names: {get_attr: [{{primary_role_name}}, hostname]} controller_names: {get_attr: [{{primary_role_name}}, hostname]}
service_ips: service_ips:
@ -732,41 +728,41 @@ resources:
expression: dict($.data.l.where($ != null).selectMany($.items()).groupBy($[0], $[1]).select([$[0], $[1].flatten()])) expression: dict($.data.l.where($ != null).selectMany($.items()).groupBy($[0], $[1]).select([$[0], $[1].flatten()]))
data: data:
l: l:
{% for role in roles %} {%- for role in roles %}
- {get_attr: [{{role.name}}IpListMap, service_ips]} - {get_attr: [{{role.name}}IpListMap, service_ips]}
{% endfor %} {%- endfor %}
service_node_names: service_node_names:
yaql: yaql:
expression: dict($.data.l.where($ != null).selectMany($.items()).groupBy($[0], $[1]).select([$[0], $[1].flatten()])) expression: dict($.data.l.where($ != null).selectMany($.items()).groupBy($[0], $[1]).select([$[0], $[1].flatten()]))
data: data:
l: l:
{% for role in roles %} {%- for role in roles %}
- {get_attr: [{{role.name}}IpListMap, service_hostnames]} - {get_attr: [{{role.name}}IpListMap, service_hostnames]}
{% endfor %} {%- endfor %}
short_service_node_names: short_service_node_names:
yaql: yaql:
expression: dict($.data.l.where($ != null).selectMany($.items()).groupBy($[0], $[1]).select([$[0], $[1].flatten()])) expression: dict($.data.l.where($ != null).selectMany($.items()).groupBy($[0], $[1]).select([$[0], $[1].flatten()]))
data: data:
l: l:
{% for role in roles %} {%- for role in roles %}
- {get_attr: [{{role.name}}IpListMap, short_service_hostnames]} - {get_attr: [{{role.name}}IpListMap, short_service_hostnames]}
{% endfor %} {%- endfor %}
short_service_bootstrap_node: short_service_bootstrap_node:
yaql: yaql:
expression: dict($.data.l.where($ != null).selectMany($.items()).groupBy($[0], $[1]).select([$[0], $[1].flatten().first()])) expression: dict($.data.l.where($ != null).selectMany($.items()).groupBy($[0], $[1]).select([$[0], $[1].flatten().first()]))
data: data:
l: l:
{% for role in roles %} {%- for role in roles %}
- {get_attr: [{{role.name}}IpListMap, short_service_bootstrap_hostnames]} - {get_attr: [{{role.name}}IpListMap, short_service_bootstrap_hostnames]}
{% endfor %} {%- endfor %}
service_bootstrap_node_ip: service_bootstrap_node_ip:
yaql: yaql:
expression: dict($.data.l.where($ != null).selectMany($.items()).groupBy($[0], $[1]).select([$[0], $[1].flatten().first(null)])) expression: dict($.data.l.where($ != null).selectMany($.items()).groupBy($[0], $[1]).select([$[0], $[1].flatten().first(null)]))
data: data:
l: l:
{% for role in roles %} {%- for role in roles %}
- {get_attr: [{{role.name}}IpListMap, service_bootstrap_ips]} - {get_attr: [{{role.name}}IpListMap, service_bootstrap_ips]}
{% endfor %} {%- endfor %}
NetVipMap: {get_attr: [VipMap, net_ip_map]} NetVipMap: {get_attr: [VipMap, net_ip_map]}
RedisVirtualIP: {get_attr: [RedisVirtualIP, ip_address]} RedisVirtualIP: {get_attr: [RedisVirtualIP, ip_address]}
ServiceNetMap: {get_attr: [ServiceNetMap, service_net_map_lower]} ServiceNetMap: {get_attr: [ServiceNetMap, service_net_map_lower]}
@ -832,8 +828,8 @@ resources:
- {get_param: RedisVirtualFixedIPs} - {get_param: RedisVirtualFixedIPs}
- [{subnet: {get_attr: [ServiceNetMap, vip_subnet_map, redis]}}] - [{subnet: {get_attr: [ServiceNetMap, vip_subnet_map, redis]}}]
{%- for network in networks if network.vip|default(false) %} {%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
{%- if network.name == 'External' %} {%- if network.name == 'External' %}
# The public VIP is on the External net, falls back to ctlplane # The public VIP is on the External net, falls back to ctlplane
PublicVirtualIP: PublicVirtualIP:
depends_on: [Networks, ServiceNetMap] depends_on: [Networks, ServiceNetMap]
@ -852,7 +848,7 @@ resources:
- public_virtual_fixed_ip_set - public_virtual_fixed_ip_set
- {get_param: PublicVirtualFixedIPs} - {get_param: PublicVirtualFixedIPs}
- [{subnet: {get_attr: [ServiceNetMap, vip_subnet_map, {{network.name}}]}}] - [{subnet: {get_attr: [ServiceNetMap, vip_subnet_map, {{network.name}}]}}]
{%- else %} {%- else %}
{{network.name}}VirtualIP: {{network.name}}VirtualIP:
depends_on: [Networks, ServiceNetMap] depends_on: [Networks, ServiceNetMap]
type: OS::TripleO::Network::Ports::{{network.name}}VipPort type: OS::TripleO::Network::Ports::{{network.name}}VipPort
@ -869,7 +865,7 @@ resources:
- {{network.name_lower}}_virtual_fixed_ip_set - {{network.name_lower}}_virtual_fixed_ip_set
- {get_param: {{network.name}}VirtualFixedIPs} - {get_param: {{network.name}}VirtualFixedIPs}
- [{subnet: {get_attr: [ServiceNetMap, vip_subnet_map, {{network.name}}]}}] - [{subnet: {get_attr: [ServiceNetMap, vip_subnet_map, {{network.name}}]}}]
{%- endif %} {% endif %}
{%- endfor %} {%- endfor %}
VipMap: VipMap:
@ -881,14 +877,14 @@ resources:
- ctlplane_subnet_cidr_set - ctlplane_subnet_cidr_set
- {get_param: ControlPlaneSubnetCidr} - {get_param: ControlPlaneSubnetCidr}
- {str_split: ['/', {get_attr: [ControlVirtualIP, subnets, 0, cidr]}, 1]} - {str_split: ['/', {get_attr: [ControlVirtualIP, subnets, 0, cidr]}, 1]}
{%- for network in networks if network.vip|default(false) %} {%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
{%- if network.name == 'External' %} {%- if network.name == 'External' %}
ExternalIp: {get_attr: [PublicVirtualIP, ip_address]} ExternalIp: {get_attr: [PublicVirtualIP, ip_address]}
ExternalIpUri: {get_attr: [PublicVirtualIP, ip_address_uri]} ExternalIpUri: {get_attr: [PublicVirtualIP, ip_address_uri]}
{%- else %} {%- else %}
{{network.name}}Ip: {get_attr: [{{network.name}}VirtualIP, ip_address]} {{network.name}}Ip: {get_attr: [{{network.name}}VirtualIP, ip_address]}
{{network.name}}IpUri: {get_attr: [{{network.name}}VirtualIP, ip_address_uri]} {{network.name}}IpUri: {get_attr: [{{network.name}}VirtualIP, ip_address_uri]}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
# No tenant or management VIP required # No tenant or management VIP required
# Because of nested get_attr functions in the KeystoneAdminVip output, we # Because of nested get_attr functions in the KeystoneAdminVip output, we
@ -896,22 +892,24 @@ resources:
# ServiceNetMap's attribute values are available. # ServiceNetMap's attribute values are available.
depends_on: ServiceNetMap depends_on: ServiceNetMap
{%- for role in roles %}
# All Nodes Validations # All Nodes Validations
{%- for role in roles %}
{{role.name}}AllNodesValidationConfig: {{role.name}}AllNodesValidationConfig:
type: OS::TripleO::AllNodes::Validation type: OS::TripleO::AllNodes::Validation
properties: properties:
PingTestIps: PingTestIps:
list_join: list_join:
- ' ' - ' '
- - - yaql:
{%- for network in networks %} expression: coalesce($.data, []).first(null)
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %} data: {get_attr: [{{primary_role_name}}, ip_address]}
{%- for network in networks %}
{%- if network.enabled|default(true) and network.name in role.networks|default([]) %}
- yaql: - yaql:
expression: coalesce($.data, []).first(null) expression: coalesce($.data, []).first(null)
data: {get_attr: [{{primary_role_name}}, {{network.name_lower}}_ip_address]} data: {get_attr: [{{primary_role_name}}, {{network.name_lower}}_ip_address]}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
{%- endfor %} {%- endfor %}
# Optional ExtraConfig for all nodes - all roles are passed in here, but # Optional ExtraConfig for all nodes - all roles are passed in here, but
@ -919,46 +917,46 @@ resources:
AllNodesExtraConfig: AllNodesExtraConfig:
type: OS::TripleO::AllNodesExtraConfig type: OS::TripleO::AllNodesExtraConfig
depends_on: depends_on:
{% for role in roles %} {%- for role in roles %}
- {{role.name}}AllNodesValidationDeployment - {{role.name}}AllNodesValidationDeployment
{% endfor %} {%- endfor %}
properties: properties:
servers: servers:
{% for role in roles %} {%- for role in roles %}
{{role.name}}: {get_attr: [{{role.name}}Servers, value]} {{role.name}}: {get_attr: [{{role.name}}Servers, value]}
{% endfor %} {%- endfor %}
BlacklistedIpAddresses: BlacklistedIpAddresses:
type: OS::Heat::Value type: OS::Heat::Value
properties: properties:
value: value:
list_concat: list_concat:
{% for role in roles %} {%- for role in roles %}
- {get_attr: [{{role.name}}, blacklist_ip_address]} - {get_attr: [{{role.name}}, blacklist_ip_address]}
{% endfor %} {%- endfor %}
BlacklistedHostnames: BlacklistedHostnames:
type: OS::Heat::Value type: OS::Heat::Value
properties: properties:
value: value:
list_concat: list_concat:
{% for role in roles %} {%- for role in roles %}
- {get_attr: [{{role.name}}, blacklist_hostname]} - {get_attr: [{{role.name}}, blacklist_hostname]}
{% endfor %} {%- endfor %}
# Post deployment steps for all roles # Post deployment steps for all roles
AllNodesDeploySteps: AllNodesDeploySteps:
type: OS::TripleO::PostDeploySteps type: OS::TripleO::PostDeploySteps
depends_on: depends_on:
- AllNodesExtraConfig - AllNodesExtraConfig
{% for role in roles %} {%- for role in roles %}
- {{role.name}}AllNodesDeployment - {{role.name}}AllNodesDeployment
{% endfor %} {%- endfor %}
properties: properties:
servers: servers:
{% for role in roles %} {%- for role in roles %}
{{role.name}}: {get_attr: [{{role.name}}Servers, value]} {{role.name}}: {get_attr: [{{role.name}}Servers, value]}
{% endfor %} {%- endfor %}
stack_name: {get_param: 'OS::stack_name'} stack_name: {get_param: 'OS::stack_name'}
EndpointMap: {get_attr: [EndpointMapData, value]} EndpointMap: {get_attr: [EndpointMapData, value]}
ctlplane_service_ips: ctlplane_service_ips:
@ -970,39 +968,39 @@ resources:
expression: dict($.data.l.where($ != null).selectMany($.items()).groupBy($[0], $[1]).select([$[0], $[1].flatten()])) expression: dict($.data.l.where($ != null).selectMany($.items()).groupBy($[0], $[1]).select([$[0], $[1].flatten()]))
data: data:
l: l:
{% for role in roles %} {%- for role in roles %}
- {get_attr: [{{role.name}}IpListMap, ctlplane_service_ips]} - {get_attr: [{{role.name}}IpListMap, ctlplane_service_ips]}
{% endfor %} {%- endfor %}
role_data: role_data:
{% for role in roles %} {%- for role in roles %}
{{role.name}}: {{role.name}}:
map_merge: map_merge:
- {get_attr: [{{role.name}}ServiceChainRoleData, value]} - {get_attr: [{{role.name}}ServiceChainRoleData, value]}
- {get_attr: [{{role.name}}MergedConfigSettings, value]} - {get_attr: [{{role.name}}MergedConfigSettings, value]}
{% endfor %} {%- endfor %}
blacklisted_ip_addresses: {get_attr: [BlacklistedIpAddresses, value]} blacklisted_ip_addresses: {get_attr: [BlacklistedIpAddresses, value]}
blacklisted_hostnames: {get_attr: [BlacklistedHostnames, value]} blacklisted_hostnames: {get_attr: [BlacklistedHostnames, value]}
ssh_known_hosts_hostnames: {get_attr: [SshKnownHostsHostnames, value]} ssh_known_hosts_hostnames: {get_attr: [SshKnownHostsHostnames, value]}
{% for role in roles %} {%- for role in roles %}
{{role.name}}Count: {get_param: {{role.name}}Count} {{role.name}}Count: {get_param: {{role.name}}Count}
{% endfor %} {%- endfor %}
ServerOsCollectConfigData: ServerOsCollectConfigData:
type: OS::Heat::Value type: OS::Heat::Value
properties: properties:
type: json type: json
value: value:
{% for role in roles %} {%- for role in roles %}
{{role.name}}: {get_attr: [{{role.name}}, attributes, os_collect_config]} {{role.name}}: {get_attr: [{{role.name}}, attributes, os_collect_config]}
{% endfor %} {%- endfor %}
DeployedServerEnvironment: DeployedServerEnvironment:
type: OS::TripleO::DeployedServerEnvironment type: OS::TripleO::DeployedServerEnvironment
properties: properties:
RoleCounts: RoleCounts:
{% for role in roles %} {%- for role in roles %}
{{role.name}}DeployedServerCount: {get_param: {{role.name}}Count} {{role.name}}DeployedServerCount: {get_param: {{role.name}}Count}
{% endfor %} {%- endfor %}
VipMap: VipMap:
map_merge: map_merge:
- {get_attr: [VipMap, net_ip_map]} - {get_attr: [VipMap, net_ip_map]}
@ -1010,15 +1008,15 @@ resources:
DeployedServerPortMap: DeployedServerPortMap:
map_merge: map_merge:
list_concat: list_concat:
{% for role in roles %} {%- for role in roles %}
- {get_attr: [{{role.name}}, deployed_server_port_map]} - {get_attr: [{{role.name}}, deployed_server_port_map]}
{% endfor %} {%- endfor %}
DeployedServerDeploymentSwiftDataMap: DeployedServerDeploymentSwiftDataMap:
map_merge: map_merge:
list_concat: list_concat:
{% for role in roles %} {%- for role in roles %}
- {get_attr: [{{role.name}}, deployed_server_deployment_swift_data_map]} - {get_attr: [{{role.name}}, deployed_server_deployment_swift_data_map]}
{% endfor %} {%- endfor %}
DefaultRouteIp: DefaultRouteIp:
str_split: str_split:
- ':' - ':'
@ -1062,40 +1060,40 @@ outputs:
EnabledServices: EnabledServices:
description: The services enabled on each role description: The services enabled on each role
value: value:
{% for role in roles %} {%- for role in roles %}
{{role.name}}: {get_attr: [{{role.name}}ServiceNames, value]} {{role.name}}: {get_attr: [{{role.name}}ServiceNames, value]}
{% endfor %} {%- endfor %}
RoleData: RoleData:
description: The configuration data associated with each role description: The configuration data associated with each role
value: value:
{% for role in roles %} {%- for role in roles %}
{{role.name}}: {{role.name}}:
map_merge: map_merge:
- {get_attr: [{{role.name}}ServiceChainRoleData, value]} - {get_attr: [{{role.name}}ServiceChainRoleData, value]}
- {get_attr: [{{role.name}}MergedConfigSettings, value]} - {get_attr: [{{role.name}}MergedConfigSettings, value]}
{% endfor %} {%- endfor %}
RoleConfig: RoleConfig:
description: The configuration workflows associated with each role description: The configuration workflows associated with each role
value: {get_attr: [AllNodesDeploySteps, RoleConfig]} value: {get_attr: [AllNodesDeploySteps, RoleConfig]}
RoleNetIpMap: RoleNetIpMap:
description: Mapping of each network to a list of IPs for each role description: Mapping of each network to a list of IPs for each role
value: value:
{% for role in roles %} {%- for role in roles %}
{{role.name}}: {get_attr: [{{role.name}}IpListMap, net_ip_map]} {{role.name}}: {get_attr: [{{role.name}}IpListMap, net_ip_map]}
{% endfor %} {%- endfor %}
RoleGroupVars: RoleGroupVars:
description: Mapping of roles to ansible group_vars to be applied config in those roles description: Mapping of roles to ansible group_vars to be applied config in those roles
value: value:
{% for role in roles %} {%- for role in roles %}
{{role.name}}: {{role.name}}:
map_merge: {get_attr: [{{role.name}}, role_group_vars]} map_merge: {get_attr: [{{role.name}}, role_group_vars]}
{% endfor %} {%- endfor %}
RoleNetHostnameMap: RoleNetHostnameMap:
description: Mapping of each network to a list of hostnames for each role description: Mapping of each network to a list of hostnames for each role
value: value:
{% for role in roles %} {%- for role in roles %}
{{role.name}}: {get_attr: [{{role.name}}NetworkHostnameMap, value]} {{role.name}}: {get_attr: [{{role.name}}NetworkHostnameMap, value]}
{% endfor %} {%- endfor %}
RoleTags: RoleTags:
description: Tags for each role, as defined in roles_data.yaml description: Tags for each role, as defined in roles_data.yaml
value: value:

View File

@ -1,5 +1,5 @@
{%- set _networks = [] -%} {%- set _networks = [] -%}
{%- for network in networks -%} {%- for network in networks if network.enabled|default(true) -%}
{%- set _networks = _networks.append(network.name) -%} {%- set _networks = _networks.append(network.name) -%}
{%- endfor -%} {%- endfor -%}
heat_template_version: rocky heat_template_version: rocky
@ -70,7 +70,7 @@ parameters:
default: {} default: {}
description: Map of extra data (hieradata) to set on each node. description: Map of extra data (hieradata) to set on each node.
{%- for network in networks %} {%- for network in networks if network.enabled|default(true) %}
{{network.name}}NetName: {{network.name}}NetName:
default: {{network.name_lower}} default: {{network.name_lower}}
description: The name of the {{network.name_lower}} network. description: The name of the {{network.name_lower}} network.
@ -205,17 +205,20 @@ resources:
internal_api_virtual_ip: {get_param: [NetVipMap, {get_param: InternalApiNetName}]} internal_api_virtual_ip: {get_param: [NetVipMap, {get_param: InternalApiNetName}]}
{%- endif %} {%- endif %}
network_virtual_ips: network_virtual_ips:
{%- for network in networks if network.vip|default(false) %} ctlplane:
ip_address: {get_param: [NetVipMap, ctlplane]}
index: 1
{%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
# External virtual ip is currently being handled separately as public_virtual_ip. # External virtual ip is currently being handled separately as public_virtual_ip.
# Likewise, optional StorageNFS virtual ip is handled separately as ganesha_vip. # Likewise, optional StorageNFS virtual ip is handled separately as ganesha_vip.
{%- if network.name != 'External' and network.name != 'StorageNFS' %} {%- if network.name != 'External' and network.name != 'StorageNFS' %}
{{network.name_lower}}: {{network.name_lower}}:
ip_address: {get_param: [NetVipMap, {get_param: {{network.name}}NetName}]} ip_address: {get_param: [NetVipMap, {get_param: {{network.name}}NetName}]}
index: {{loop.index}} index: {{loop.index + 1}}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
redis_vip: {get_param: RedisVirtualIP} redis_vip: {get_param: RedisVirtualIP}
{%- for network in networks if network.name == 'StorageNFS' %} {%- for network in networks if network.name == 'StorageNFS' and network.enabled|default(true) %}
ganesha_vip: {get_param: [NetVipMap, {get_param: StorageNFSNetName}]} ganesha_vip: {get_param: [NetVipMap, {get_param: StorageNFSNetName}]}
{%- endfor %} {%- endfor %}
# public_virtual_ip and controller_virtual_ip are needed in # public_virtual_ip and controller_virtual_ip are needed in
@ -231,7 +234,7 @@ resources:
tripleo::keepalived::controller_virtual_ip: {get_param: [NetVipMap, ctlplane]} tripleo::keepalived::controller_virtual_ip: {get_param: [NetVipMap, ctlplane]}
tripleo::keepalived::redis_virtual_ip: {get_param: RedisVirtualIP} tripleo::keepalived::redis_virtual_ip: {get_param: RedisVirtualIP}
tripleo::redis_notification::haproxy_monitor_ip: {get_param: [NetVipMap, ctlplane]} tripleo::redis_notification::haproxy_monitor_ip: {get_param: [NetVipMap, ctlplane]}
{%- for network in networks if network.vip|default(false) %} {%- for network in networks if network.vip|default(false) and network.enabled|default(true) %}
cloud_name_{{network.name_lower}}: {get_param: cloud_name_{{network.name_lower}}} cloud_name_{{network.name_lower}}: {get_param: cloud_name_{{network.name_lower}}}
{%- endfor %} {%- endfor %}
cloud_name_ctlplane: {get_param: cloud_name_ctlplane} cloud_name_ctlplane: {get_param: cloud_name_ctlplane}

View File

@ -62,7 +62,7 @@ resources:
# certificates for those. We skip the tenant network since # certificates for those. We skip the tenant network since
# we don't need a certificate for that. # we don't need a certificate for that.
- ctlplane - ctlplane
{%- for network in networks %} {%- for network in networks if network.enabled|default(true) %}
{%- if network.name_lower != 'tenant' %} {%- if network.name_lower != 'tenant' %}
- {{network.name_lower}} - {{network.name_lower}}
{%- endif %} {%- endif %}

View File

@ -110,6 +110,8 @@ def process_templates(template_path, role_data_path, output_dir,
with open(network_data_path) as network_data_file: with open(network_data_path) as network_data_file:
network_data = yaml.safe_load(network_data_file) network_data = yaml.safe_load(network_data_file)
if network_data is None:
network_data = []
j2_excludes = {} j2_excludes = {}
j2_excludes_path = os.path.join(template_path, 'j2_excludes.yaml') j2_excludes_path = os.path.join(template_path, 'j2_excludes.yaml')