Convert role templates to consume roles_data map

Currently we only consume the name with a special-case
for the disable constraints boolean, but it will be more
flexible if we consume the whole roles_data mapping for
each role, so that e.g composable networks and other
per-role customizations can be expressed in these
templates

Partially-Implements: blueprint composable-networks
Depends-On: Id1249b78b3dd87e91d572ffa31b7a541f3cde2c7
Change-Id: I355534ec456479944f66106e957404a660d8f2d2
This commit is contained in:
Steven Hardy 2017-05-31 11:22:49 +01:00
parent b5081b67e5
commit 6a2f8bd502
2 changed files with 113 additions and 101 deletions

View File

@ -1,18 +1,18 @@
heat_template_version: pike heat_template_version: pike
description: 'OpenStack {{role}} node configured by Puppet' description: 'OpenStack {{role.name}} node configured by Puppet'
parameters: parameters:
Overcloud{{role}}Flavor: Overcloud{{role.name}}Flavor:
description: Flavor for the {{role}} node. description: Flavor for the {{role.name}} node.
default: baremetal default: baremetal
type: string type: string
{% if disable_constraints is not defined %} {% if role.disable_constraints is not defined %}
constraints: constraints:
- custom_constraint: nova.flavor - custom_constraint: nova.flavor
{% endif %} {% endif %}
{{role}}Image: {{role.name}}Image:
type: string type: string
default: overcloud-full default: overcloud-full
{% if disable_constraints is not defined %} {% if role.disable_constraints is not defined %}
constraints: constraints:
- custom_constraint: glance.image - custom_constraint: glance.image
{% endif %} {% endif %}
@ -24,7 +24,7 @@ parameters:
description: Name of an existing Nova key pair to enable SSH access to the instances description: Name of an existing Nova key pair to enable SSH access to the instances
type: string type: string
default: default default: default
{% if disable_constraints is not defined %} {% if role.disable_constraints is not defined %}
constraints: constraints:
- custom_constraint: nova.keypair - custom_constraint: nova.keypair
{% endif %} {% endif %}
@ -63,14 +63,14 @@ parameters:
default: {} default: {}
description: | description: |
Additional hiera configuration to inject into the cluster. Note Additional hiera configuration to inject into the cluster. Note
that {{role}}ExtraConfig takes precedence over ExtraConfig. that {{role.name}}ExtraConfig takes precedence over ExtraConfig.
type: json type: json
{{role}}ExtraConfig: {{role.name}}ExtraConfig:
default: {} default: {}
description: | description: |
Role specific additional hiera configuration to inject into the cluster. Role specific additional hiera configuration to inject into the cluster.
type: json type: json
{{role}}IPs: {{role.name}}IPs:
default: {} default: {}
type: json type: json
NetworkDeploymentActions: NetworkDeploymentActions:
@ -91,7 +91,7 @@ parameters:
description: > description: >
The DNS domain used for the hosts. This must match the The DNS domain used for the hosts. This must match the
overcloud_domain_name configured on the undercloud. overcloud_domain_name configured on the undercloud.
{{role}}ServerMetadata: {{role.name}}ServerMetadata:
default: {} default: {}
description: > description: >
Extra properties or metadata passed to Nova for the created nodes in Extra properties or metadata passed to Nova for the created nodes in
@ -106,7 +106,7 @@ parameters:
the overcloud. It's accessible via the Nova metadata API. This applies to the overcloud. It's accessible via the Nova metadata API. This applies to
all roles and is merged with a role-specific metadata parameter. all roles and is merged with a role-specific metadata parameter.
type: json type: json
{{role}}SchedulerHints: {{role.name}}SchedulerHints:
type: json type: json
description: Optional scheduler hints to pass to nova description: Optional scheduler hints to pass to nova
default: {} default: {}
@ -203,16 +203,16 @@ conditions:
- "" - ""
resources: resources:
{{role}}: {{role.name}}:
type: OS::TripleO::{{role}}Server type: OS::TripleO::{{role.name}}Server
metadata: metadata:
os-collect-config: os-collect-config:
command: {get_param: ConfigCommand} command: {get_param: ConfigCommand}
splay: {get_param: ConfigCollectSplay} splay: {get_param: ConfigCollectSplay}
properties: properties:
image: {get_param: {{role}}Image} image: {get_param: {{role.name}}Image}
image_update_policy: {get_param: ImageUpdatePolicy} image_update_policy: {get_param: ImageUpdatePolicy}
flavor: {get_param: Overcloud{{role}}Flavor} flavor: {get_param: Overcloud{{role.name}}Flavor}
key_name: {get_param: KeyName} key_name: {get_param: KeyName}
networks: networks:
- network: ctlplane - network: ctlplane
@ -226,9 +226,9 @@ resources:
metadata: metadata:
map_merge: map_merge:
- {get_param: ServerMetadata} - {get_param: ServerMetadata}
- {get_param: {{role}}ServerMetadata} - {get_param: {{role.name}}ServerMetadata}
- {get_param: ServiceMetadataSettings} - {get_param: ServiceMetadataSettings}
scheduler_hints: {get_param: {{role}}SchedulerHints} scheduler_hints: {get_param: {{role.name}}SchedulerHints}
deployment_swift_data: deployment_swift_data:
if: if:
- deployment_swift_data_map_unset - deployment_swift_data_map_unset
@ -261,54 +261,54 @@ resources:
# For optional operator role-specific userdata # For optional operator role-specific userdata
# Should return a OS::Heat::MultipartMime reference via OS::stack_id # Should return a OS::Heat::MultipartMime reference via OS::stack_id
RoleUserData: RoleUserData:
type: OS::TripleO::{{role}}::NodeUserData type: OS::TripleO::{{role.name}}::NodeUserData
ExternalPort: ExternalPort:
type: OS::TripleO::{{role}}::Ports::ExternalPort type: OS::TripleO::{{role.name}}::Ports::ExternalPort
properties: properties:
ControlPlaneIP: {get_attr: [{{role}}, networks, ctlplane, 0]} ControlPlaneIP: {get_attr: [{{role.name}}, networks, ctlplane, 0]}
IPPool: {get_param: {{role}}IPs} IPPool: {get_param: {{role.name}}IPs}
NodeIndex: {get_param: NodeIndex} NodeIndex: {get_param: NodeIndex}
InternalApiPort: InternalApiPort:
type: OS::TripleO::{{role}}::Ports::InternalApiPort type: OS::TripleO::{{role.name}}::Ports::InternalApiPort
properties: properties:
ControlPlaneIP: {get_attr: [{{role}}, networks, ctlplane, 0]} ControlPlaneIP: {get_attr: [{{role.name}}, networks, ctlplane, 0]}
IPPool: {get_param: {{role}}IPs} IPPool: {get_param: {{role.name}}IPs}
NodeIndex: {get_param: NodeIndex} NodeIndex: {get_param: NodeIndex}
StoragePort: StoragePort:
type: OS::TripleO::{{role}}::Ports::StoragePort type: OS::TripleO::{{role.name}}::Ports::StoragePort
properties: properties:
ControlPlaneIP: {get_attr: [{{role}}, networks, ctlplane, 0]} ControlPlaneIP: {get_attr: [{{role.name}}, networks, ctlplane, 0]}
IPPool: {get_param: {{role}}IPs} IPPool: {get_param: {{role.name}}IPs}
NodeIndex: {get_param: NodeIndex} NodeIndex: {get_param: NodeIndex}
StorageMgmtPort: StorageMgmtPort:
type: OS::TripleO::{{role}}::Ports::StorageMgmtPort type: OS::TripleO::{{role.name}}::Ports::StorageMgmtPort
properties: properties:
ControlPlaneIP: {get_attr: [{{role}}, networks, ctlplane, 0]} ControlPlaneIP: {get_attr: [{{role.name}}, networks, ctlplane, 0]}
IPPool: {get_param: {{role}}IPs} IPPool: {get_param: {{role.name}}IPs}
NodeIndex: {get_param: NodeIndex} NodeIndex: {get_param: NodeIndex}
TenantPort: TenantPort:
type: OS::TripleO::{{role}}::Ports::TenantPort type: OS::TripleO::{{role.name}}::Ports::TenantPort
properties: properties:
ControlPlaneIP: {get_attr: [{{role}}, networks, ctlplane, 0]} ControlPlaneIP: {get_attr: [{{role.name}}, networks, ctlplane, 0]}
IPPool: {get_param: {{role}}IPs} IPPool: {get_param: {{role.name}}IPs}
NodeIndex: {get_param: NodeIndex} NodeIndex: {get_param: NodeIndex}
ManagementPort: ManagementPort:
type: OS::TripleO::{{role}}::Ports::ManagementPort type: OS::TripleO::{{role.name}}::Ports::ManagementPort
properties: properties:
ControlPlaneIP: {get_attr: [{{role}}, networks, ctlplane, 0]} ControlPlaneIP: {get_attr: [{{role.name}}, networks, ctlplane, 0]}
IPPool: {get_param: {{role}}IPs} IPPool: {get_param: {{role.name}}IPs}
NodeIndex: {get_param: NodeIndex} NodeIndex: {get_param: NodeIndex}
NetworkConfig: NetworkConfig:
type: OS::TripleO::{{role}}::Net::SoftwareConfig type: OS::TripleO::{{role.name}}::Net::SoftwareConfig
properties: properties:
ControlPlaneIp: {get_attr: [{{role}}, networks, ctlplane, 0]} ControlPlaneIp: {get_attr: [{{role.name}}, networks, ctlplane, 0]}
ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]} ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]} InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]} StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
@ -319,7 +319,7 @@ resources:
NetIpMap: NetIpMap:
type: OS::TripleO::Network::Ports::NetIpMap type: OS::TripleO::Network::Ports::NetIpMap
properties: properties:
ControlPlaneIp: {get_attr: [{{role}}, networks, ctlplane, 0]} ControlPlaneIp: {get_attr: [{{role.name}}, networks, ctlplane, 0]}
ExternalIp: {get_attr: [ExternalPort, ip_address]} ExternalIp: {get_attr: [ExternalPort, ip_address]}
ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]} ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]} ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
@ -348,91 +348,91 @@ resources:
fqdn: fqdn:
list_join: list_join:
- '.' - '.'
- - {get_attr: [{{role}}, name]} - - {get_attr: [{{role.name}}, name]}
- external - external
- {get_param: CloudDomain} - {get_param: CloudDomain}
short: short:
list_join: list_join:
- '.' - '.'
- - {get_attr: [{{role}}, name]} - - {get_attr: [{{role.name}}, name]}
- external - external
internal_api: internal_api:
fqdn: fqdn:
list_join: list_join:
- '.' - '.'
- - {get_attr: [{{role}}, name]} - - {get_attr: [{{role.name}}, name]}
- internalapi - internalapi
- {get_param: CloudDomain} - {get_param: CloudDomain}
short: short:
list_join: list_join:
- '.' - '.'
- - {get_attr: [{{role}}, name]} - - {get_attr: [{{role.name}}, name]}
- internalapi - internalapi
storage: storage:
fqdn: fqdn:
list_join: list_join:
- '.' - '.'
- - {get_attr: [{{role}}, name]} - - {get_attr: [{{role.name}}, name]}
- storage - storage
- {get_param: CloudDomain} - {get_param: CloudDomain}
short: short:
list_join: list_join:
- '.' - '.'
- - {get_attr: [{{role}}, name]} - - {get_attr: [{{role.name}}, name]}
- storage - storage
storage_mgmt: storage_mgmt:
fqdn: fqdn:
list_join: list_join:
- '.' - '.'
- - {get_attr: [{{role}}, name]} - - {get_attr: [{{role.name}}, name]}
- storagemgmt - storagemgmt
- {get_param: CloudDomain} - {get_param: CloudDomain}
short: short:
list_join: list_join:
- '.' - '.'
- - {get_attr: [{{role}}, name]} - - {get_attr: [{{role.name}}, name]}
- storagemgmt - storagemgmt
tenant: tenant:
fqdn: fqdn:
list_join: list_join:
- '.' - '.'
- - {get_attr: [{{role}}, name]} - - {get_attr: [{{role.name}}, name]}
- tenant - tenant
- {get_param: CloudDomain} - {get_param: CloudDomain}
short: short:
list_join: list_join:
- '.' - '.'
- - {get_attr: [{{role}}, name]} - - {get_attr: [{{role.name}}, name]}
- tenant - tenant
management: management:
fqdn: fqdn:
list_join: list_join:
- '.' - '.'
- - {get_attr: [{{role}}, name]} - - {get_attr: [{{role.name}}, name]}
- management - management
- {get_param: CloudDomain} - {get_param: CloudDomain}
short: short:
list_join: list_join:
- '.' - '.'
- - {get_attr: [{{role}}, name]} - - {get_attr: [{{role.name}}, name]}
- management - management
ctlplane: ctlplane:
fqdn: fqdn:
list_join: list_join:
- '.' - '.'
- - {get_attr: [{{role}}, name]} - - {get_attr: [{{role.name}}, name]}
- ctlplane - ctlplane
- {get_param: CloudDomain} - {get_param: CloudDomain}
short: short:
list_join: list_join:
- '.' - '.'
- - {get_attr: [{{role}}, name]} - - {get_attr: [{{role.name}}, name]}
- ctlplane - ctlplane
PreNetworkConfig: PreNetworkConfig:
type: OS::TripleO::{{role}}::PreNetworkConfig type: OS::TripleO::{{role.name}}::PreNetworkConfig
properties: properties:
server: {get_resource: {{role}}} server: {get_resource: {{role.name}}}
RoleParameters: {get_param: RoleParameters} RoleParameters: {get_param: RoleParameters}
ServiceNames: {get_param: ServiceNames} ServiceNames: {get_param: ServiceNames}
@ -442,7 +442,7 @@ resources:
properties: properties:
name: NetworkDeployment name: NetworkDeployment
config: {get_resource: NetworkConfig} config: {get_resource: NetworkConfig}
server: {get_resource: {{role}}} server: {get_resource: {{role.name}}}
actions: {get_param: NetworkDeploymentActions} actions: {get_param: NetworkDeploymentActions}
input_values: input_values:
bridge_name: {get_param: NeutronPhysicalBridge} bridge_name: {get_param: NeutronPhysicalBridge}
@ -453,7 +453,7 @@ resources:
- {get_param: NetworkDeploymentActions} - {get_param: NetworkDeploymentActions}
- [] - []
{{role}}UpgradeInitConfig: {{role.name}}UpgradeInitConfig:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
group: script group: script
@ -467,26 +467,26 @@ resources:
# Note we may be able to make this conditional on UpgradeInitCommandNotEmpty # Note we may be able to make this conditional on UpgradeInitCommandNotEmpty
# but https://bugs.launchpad.net/heat/+bug/1649900 needs fixing first # but https://bugs.launchpad.net/heat/+bug/1649900 needs fixing first
{{role}}UpgradeInitDeployment: {{role.name}}UpgradeInitDeployment:
type: OS::Heat::SoftwareDeployment type: OS::Heat::SoftwareDeployment
depends_on: NetworkDeployment depends_on: NetworkDeployment
properties: properties:
name: {{role}}UpgradeInitDeployment name: {{role.name}}UpgradeInitDeployment
server: {get_resource: {{role}}} server: {get_resource: {{role.name}}}
config: {get_resource: {{role}}UpgradeInitConfig} config: {get_resource: {{role.name}}UpgradeInitConfig}
actions: actions:
if: if:
- server_not_blacklisted - server_not_blacklisted
- ['CREATE', 'UPDATE'] - ['CREATE', 'UPDATE']
- [] - []
{{role}}Deployment: {{role.name}}Deployment:
type: OS::Heat::StructuredDeployment type: OS::Heat::StructuredDeployment
depends_on: {{role}}UpgradeInitDeployment depends_on: {{role.name}}UpgradeInitDeployment
properties: properties:
name: {{role}}Deployment name: {{role.name}}Deployment
config: {get_resource: {{role}}Config} config: {get_resource: {{role.name}}Config}
server: {get_resource: {{role}}} server: {get_resource: {{role.name}}}
input_values: input_values:
enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]} enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
actions: actions:
@ -495,7 +495,7 @@ resources:
- ['CREATE', 'UPDATE'] - ['CREATE', 'UPDATE']
- [] - []
{{role}}Config: {{role.name}}Config:
type: OS::Heat::StructuredConfig type: OS::Heat::StructuredConfig
properties: properties:
group: hiera group: hiera
@ -504,11 +504,11 @@ resources:
- '"%{::uuid}"' - '"%{::uuid}"'
- heat_config_%{::deploy_config_name} - heat_config_%{::deploy_config_name}
- config_step - config_step
- {{role.lower()}}_extraconfig - {{role.name.lower()}}_extraconfig
- extraconfig - extraconfig
- service_names - service_names
- service_configs - service_configs
- {{role.lower()}} - {{role.name.lower()}}
- bootstrap_node # provided by allNodesConfig - bootstrap_node # provided by allNodesConfig
- all_nodes # provided by allNodesConfig - all_nodes # provided by allNodesConfig
- vip_data # provided by allNodesConfig - vip_data # provided by allNodesConfig
@ -522,9 +522,9 @@ resources:
map_replace: map_replace:
- {get_param: ServiceConfigSettings} - {get_param: ServiceConfigSettings}
- values: {get_attr: [NetIpMap, net_ip_map]} - values: {get_attr: [NetIpMap, net_ip_map]}
{{role.lower()}}_extraconfig: {get_param: {{role}}ExtraConfig} {{role.name.lower()}}_extraconfig: {get_param: {{role.name}}ExtraConfig}
extraconfig: {get_param: ExtraConfig} extraconfig: {get_param: ExtraConfig}
{{role.lower()}}: {{role.name.lower()}}:
tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade} tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
tripleo::profile::base::logging::fluentd::fluentd_sources: {get_param: LoggingSources} tripleo::profile::base::logging::fluentd::fluentd_sources: {get_param: LoggingSources}
tripleo::profile::base::logging::fluentd::fluentd_groups: {get_param: LoggingGroups} tripleo::profile::base::logging::fluentd::fluentd_groups: {get_param: LoggingGroups}
@ -538,25 +538,25 @@ resources:
# Resource for site-specific injection of root certificate # Resource for site-specific injection of root certificate
NodeTLSCAData: NodeTLSCAData:
depends_on: {{role}}Deployment depends_on: {{role.name}}Deployment
type: OS::TripleO::NodeTLSCAData type: OS::TripleO::NodeTLSCAData
properties: properties:
server: {get_resource: {{role}}} server: {get_resource: {{role.name}}}
# Hook for site-specific additional pre-deployment config, e.g extra hieradata # Hook for site-specific additional pre-deployment config, e.g extra hieradata
{{role}}ExtraConfigPre: {{role.name}}ExtraConfigPre:
depends_on: {{role}}Deployment depends_on: {{role.name}}Deployment
type: OS::TripleO::{{role}}ExtraConfigPre type: OS::TripleO::{{role.name}}ExtraConfigPre
properties: properties:
server: {get_resource: {{role}}} server: {get_resource: {{role.name}}}
# Hook for site-specific additional pre-deployment config, # Hook for site-specific additional pre-deployment config,
# applying to all nodes, e.g node registration/unregistration # applying to all nodes, e.g node registration/unregistration
NodeExtraConfig: NodeExtraConfig:
depends_on: [{{role}}ExtraConfigPre, NodeTLSCAData] depends_on: [{{role.name}}ExtraConfigPre, NodeTLSCAData]
type: OS::TripleO::NodeExtraConfig type: OS::TripleO::NodeExtraConfig
properties: properties:
server: {get_resource: {{role}}} server: {get_resource: {{role.name}}}
UpdateConfig: UpdateConfig:
type: OS::TripleO::Tasks::PackageUpdate type: OS::TripleO::Tasks::PackageUpdate
@ -567,7 +567,7 @@ resources:
properties: properties:
name: UpdateDeployment name: UpdateDeployment
config: {get_resource: UpdateConfig} config: {get_resource: UpdateConfig}
server: {get_resource: {{role}}} server: {get_resource: {{role.name}}}
input_values: input_values:
update_identifier: update_identifier:
get_param: UpdateIdentifier get_param: UpdateIdentifier
@ -579,17 +579,17 @@ resources:
SshHostPubKey: SshHostPubKey:
type: OS::TripleO::Ssh::HostPubKey type: OS::TripleO::Ssh::HostPubKey
depends_on: {{role}}Deployment depends_on: {{role.name}}Deployment
properties: properties:
server: {get_resource: {{role}}} server: {get_resource: {{role.name}}}
outputs: outputs:
ip_address: ip_address:
description: IP address of the server in the ctlplane network description: IP address of the server in the ctlplane network
value: {get_attr: [{{role}}, networks, ctlplane, 0]} value: {get_attr: [{{role.name}}, networks, ctlplane, 0]}
hostname: hostname:
description: Hostname of the server description: Hostname of the server
value: {get_attr: [{{role}}, name]} value: {get_attr: [{{role.name}}, name]}
hostname_map: hostname_map:
description: Mapping of network names to hostnames description: Mapping of network names to hostnames
value: value:
@ -613,9 +613,9 @@ outputs:
MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
params: params:
PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, {{role}}HostnameResolveNetwork]}]} PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, {{role.name}}HostnameResolveNetwork]}]}
DOMAIN: {get_param: CloudDomain} DOMAIN: {get_param: CloudDomain}
PRIMARYHOST: {get_attr: [{{role}}, name]} PRIMARYHOST: {get_attr: [{{role.name}}, name]}
EXTERNALIP: {get_attr: [ExternalPort, ip_address]} EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
EXTERNALHOST: {get_attr: [NetHostMap, value, external, short]} EXTERNALHOST: {get_attr: [NetHostMap, value, external, short]}
INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]} INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
@ -628,7 +628,7 @@ outputs:
TENANTHOST: {get_attr: [NetHostMap, value, tenant, short]} TENANTHOST: {get_attr: [NetHostMap, value, tenant, short]}
MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]} MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
MANAGEMENTHOST: {get_attr: [NetHostMap, value, management, short]} MANAGEMENTHOST: {get_attr: [NetHostMap, value, management, short]}
CTLPLANEIP: {get_attr: [{{role}}, networks, ctlplane, 0]} CTLPLANEIP: {get_attr: [{{role.name}}, networks, ctlplane, 0]}
CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]} CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
known_hosts_entry: known_hosts_entry:
description: Entry for ssh known hosts description: Entry for ssh known hosts
@ -643,9 +643,9 @@ TENANTIP,TENANTHOST.DOMAIN,TENANTHOST,\
MANAGEMENTIP,MANAGEMENTHOST.DOMAIN,MANAGEMENTHOST,\ MANAGEMENTIP,MANAGEMENTHOST.DOMAIN,MANAGEMENTHOST,\
CTLPLANEIP,CTLPLANEHOST.DOMAIN,CTLPLANEHOST HOSTSSHPUBKEY" CTLPLANEIP,CTLPLANEHOST.DOMAIN,CTLPLANEHOST HOSTSSHPUBKEY"
params: params:
PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, {{role}}HostnameResolveNetwork]}]} PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, {{role.name}}HostnameResolveNetwork]}]}
DOMAIN: {get_param: CloudDomain} DOMAIN: {get_param: CloudDomain}
PRIMARYHOST: {get_attr: [{{role}}, name]} PRIMARYHOST: {get_attr: [{{role.name}}, name]}
EXTERNALIP: {get_attr: [ExternalPort, ip_address]} EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
EXTERNALHOST: {get_attr: [NetHostMap, value, external, short]} EXTERNALHOST: {get_attr: [NetHostMap, value, external, short]}
INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]} INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
@ -658,13 +658,13 @@ CTLPLANEIP,CTLPLANEHOST.DOMAIN,CTLPLANEHOST HOSTSSHPUBKEY"
TENANTHOST: {get_attr: [NetHostMap, value, tenant, short]} TENANTHOST: {get_attr: [NetHostMap, value, tenant, short]}
MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]} MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
MANAGEMENTHOST: {get_attr: [NetHostMap, value, management, short]} MANAGEMENTHOST: {get_attr: [NetHostMap, value, management, short]}
CTLPLANEIP: {get_attr: [{{role}}, networks, ctlplane, 0]} CTLPLANEIP: {get_attr: [{{role.name}}, networks, ctlplane, 0]}
CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]} CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
HOSTSSHPUBKEY: {get_attr: [SshHostPubKey, ecdsa]} HOSTSSHPUBKEY: {get_attr: [SshHostPubKey, ecdsa]}
nova_server_resource: nova_server_resource:
description: Heat resource handle for {{role}} server description: Heat resource handle for {{role.name}} server
value: value:
{get_resource: {{role}}} {get_resource: {{role.name}}}
condition: server_not_blacklisted condition: server_not_blacklisted
external_ip_address: external_ip_address:
description: IP address of the server in the external network description: IP address of the server in the external network
@ -686,4 +686,4 @@ CTLPLANEIP,CTLPLANEHOST.DOMAIN,CTLPLANEHOST HOSTSSHPUBKEY"
value: {get_attr: [ManagementPort, ip_address]} value: {get_attr: [ManagementPort, ip_address]}
os_collect_config: os_collect_config:
description: The os-collect-config configuration associated with this server resource description: The os-collect-config configuration associated with this server resource
value: {get_attr: [{{role}}, os_collect_config]} value: {get_attr: [{{role.name}}, os_collect_config]}

View File

@ -138,19 +138,31 @@ def process_templates(template_path, role_data_path, output_dir,
print("jinja2 rendering roles %s" % "," print("jinja2 rendering roles %s" % ","
.join(role_names)) .join(role_names))
for role in role_names: for role in role_names:
j2_data = {'role': role} j2_data = {'role': r_map[role]}
# (dprince) For the undercloud installer we don't
# want to have heat check nova/glance API's
if r_map[role].get('disable_constraints', False):
j2_data['disable_constraints'] = True
out_f = "-".join( out_f = "-".join(
[role.lower(), [role.lower(),
os.path.basename(f).replace('.role.j2.yaml', os.path.basename(f).replace('.role.j2.yaml',
'.yaml')]) '.yaml')])
out_f_path = os.path.join(out_dir, out_f) out_f_path = os.path.join(out_dir, out_f)
if not (out_f_path in excl_templates): if not (out_f_path in excl_templates):
_j2_render_to_file(template_data, j2_data, if '{{role.name}}' in template_data:
out_f_path, overwrite) j2_data = {'role': r_map[role]}
_j2_render_to_file(template_data, j2_data,
out_f_path, overwrite)
else:
# Backwards compatibility with templates
# that specify {{role}} vs {{role.name}}
j2_data = {'role': role}
# (dprince) For the undercloud installer we
# don'twant to have heat check nova/glance
# API's
if r_map[role].get('disable_constraints',
False):
j2_data['disable_constraints'] = True
_j2_render_to_file(
template_data,j2_data,
out_f_path, overwrite)
else: else:
print('skipping rendering of %s' % out_f_path) print('skipping rendering of %s' % out_f_path)
elif f.endswith('.j2.yaml'): elif f.endswith('.j2.yaml'):