Merge "Revert "Adjust MTU to compensate for VLAN tag issue""
[apex-tripleo-heat-templates.git] / puppet / role.role.j2.yaml
1 heat_template_version: 2016-10-14
2 description: 'OpenStack {{role}} node configured by Puppet'
3 parameters:
4   Overcloud{{role}}Flavor:
5     description: Flavor for the {{role}} node.
6     default: baremetal
7     type: string
8     constraints:
9       - custom_constraint: nova.flavor
10   {{role}}Image:
11     type: string
12     default: overcloud-full
13     constraints:
14       - custom_constraint: glance.image
15   ImageUpdatePolicy:
16     default: 'REBUILD_PRESERVE_EPHEMERAL'
17     description: What policy to use when reconstructing instances. REBUILD for rebuilds, REBUILD_PRESERVE_EPHEMERAL to preserve /mnt.
18     type: string
19   KeyName:
20     description: Name of an existing Nova key pair to enable SSH access to the instances
21     type: string
22     default: default
23     constraints:
24       - custom_constraint: nova.keypair
25   ServiceNetMap:
26     default: {}
27     description: Mapping of service_name -> network name. Typically set
28                  via parameter_defaults in the resource registry.
29     type: json
30   EndpointMap:
31     default: {}
32     description: Mapping of service endpoint -> protocol. Typically set
33                  via parameter_defaults in the resource registry.
34     type: json
35   UpdateIdentifier:
36     default: ''
37     type: string
38     description: >
39       Setting to a previously unused value during stack-update will trigger
40       package update on all nodes
41   Hostname:
42     type: string
43     default: '' # Defaults to Heat created hostname
44   HostnameMap:
45     type: json
46     default: {}
47     description: Optional mapping to override hostnames
48   ExtraConfig:
49     default: {}
50     description: |
51       Additional hiera configuration to inject into the cluster. Note
52       that {{role}}ExtraConfig takes precedence over ExtraConfig.
53     type: json
54   {{role}}ExtraConfig:
55     default: {}
56     description: |
57       Role specific additional hiera configuration to inject into the cluster.
58     type: json
59   {{role}}IPs:
60     default: {}
61     type: json
62   NetworkDeploymentActions:
63     type: comma_delimited_list
64     description: >
65       Heat action when to apply network configuration changes
66     default: ['CREATE']
67   SoftwareConfigTransport:
68     default: POLL_SERVER_CFN
69     description: |
70       How the server should receive the metadata required for software configuration.
71     type: string
72     constraints:
73     - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
74   CloudDomain:
75     type: string
76     description: >
77       The DNS domain used for the hosts. This should match the dhcp_domain
78       configured in the Undercloud neutron. Defaults to localdomain.
79   ServerMetadata:
80     default: {}
81     description: >
82       Extra properties or metadata passed to Nova for the created nodes in
83       the overcloud. It's accessible via the Nova metadata API.
84     type: json
85   {{role}}SchedulerHints:
86     type: json
87     description: Optional scheduler hints to pass to nova
88     default: {}
89   NodeIndex:
90     type: number
91     default: 0
92   ServiceConfigSettings:
93     type: json
94     default: {}
95   ServiceNames:
96     type: comma_delimited_list
97     default: []
98   MonitoringSubscriptions:
99     type: comma_delimited_list
100     default: []
101   ConfigCommand:
102     type: string
103     description: Command which will be run whenever configuration data changes
104     default: os-refresh-config --timeout 14400
105   LoggingSources:
106     type: json
107     default: []
108   LoggingGroups:
109     type: comma_delimited_list
110     default: []
111
112 resources:
113   {{role}}:
114     type: OS::TripleO::Server
115     metadata:
116       os-collect-config:
117         command: {get_param: ConfigCommand}
118     properties:
119       image: {get_param: {{role}}Image}
120       image_update_policy: {get_param: ImageUpdatePolicy}
121       flavor: {get_param: Overcloud{{role}}Flavor}
122       key_name: {get_param: KeyName}
123       networks:
124         - network: ctlplane
125       user_data_format: SOFTWARE_CONFIG
126       user_data: {get_resource: UserData}
127       name:
128         str_replace:
129             template: {get_param: Hostname}
130             params: {get_param: HostnameMap}
131       software_config_transport: {get_param: SoftwareConfigTransport}
132       metadata: {get_param: ServerMetadata}
133       scheduler_hints: {get_param: {{role}}SchedulerHints}
134
135   # Combine the NodeAdminUserData and NodeUserData mime archives
136   UserData:
137     type: OS::Heat::MultipartMime
138     properties:
139       parts:
140       - config: {get_resource: NodeAdminUserData}
141         type: multipart
142       - config: {get_resource: NodeUserData}
143         type: multipart
144
145   # Creates the "heat-admin" user if configured via the environment
146   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
147   NodeAdminUserData:
148     type: OS::TripleO::NodeAdminUserData
149
150   # For optional operator additional userdata
151   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
152   NodeUserData:
153     type: OS::TripleO::NodeUserData
154
155   ExternalPort:
156     type: OS::TripleO::{{role}}::Ports::ExternalPort
157     properties:
158       ControlPlaneIP: {get_attr: [{{role}}, networks, ctlplane, 0]}
159       IPPool: {get_param: {{role}}IPs}
160       NodeIndex: {get_param: NodeIndex}
161
162   InternalApiPort:
163     type: OS::TripleO::{{role}}::Ports::InternalApiPort
164     properties:
165       ControlPlaneIP: {get_attr: [{{role}}, networks, ctlplane, 0]}
166       IPPool: {get_param: {{role}}IPs}
167       NodeIndex: {get_param: NodeIndex}
168
169   StoragePort:
170     type: OS::TripleO::{{role}}::Ports::StoragePort
171     properties:
172       ControlPlaneIP: {get_attr: [{{role}}, networks, ctlplane, 0]}
173       IPPool: {get_param: {{role}}IPs}
174       NodeIndex: {get_param: NodeIndex}
175
176   StorageMgmtPort:
177     type: OS::TripleO::{{role}}::Ports::StorageMgmtPort
178     properties:
179       ControlPlaneIP: {get_attr: [{{role}}, networks, ctlplane, 0]}
180       IPPool: {get_param: {{role}}IPs}
181       NodeIndex: {get_param: NodeIndex}
182
183   TenantPort:
184     type: OS::TripleO::{{role}}::Ports::TenantPort
185     properties:
186       ControlPlaneIP: {get_attr: [{{role}}, networks, ctlplane, 0]}
187       IPPool: {get_param: {{role}}IPs}
188       NodeIndex: {get_param: NodeIndex}
189
190   ManagementPort:
191     type: OS::TripleO::{{role}}::Ports::ManagementPort
192     properties:
193       ControlPlaneIP: {get_attr: [{{role}}, networks, ctlplane, 0]}
194       IPPool: {get_param: {{role}}IPs}
195       NodeIndex: {get_param: NodeIndex}
196
197   NetworkConfig:
198     type: OS::TripleO::{{role}}::Net::SoftwareConfig
199     properties:
200       ControlPlaneIp: {get_attr: [{{role}}, networks, ctlplane, 0]}
201       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
202       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
203       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
204       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
205       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
206       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
207
208   NetIpMap:
209     type: OS::TripleO::Network::Ports::NetIpMap
210     properties:
211       ControlPlaneIp: {get_attr: [{{role}}, networks, ctlplane, 0]}
212       ExternalIp: {get_attr: [ExternalPort, ip_address]}
213       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
214       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
215       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
216       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
217       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
218       StorageIp: {get_attr: [StoragePort, ip_address]}
219       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
220       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
221       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
222       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
223       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
224       TenantIp: {get_attr: [TenantPort, ip_address]}
225       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
226       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
227       ManagementIp: {get_attr: [ManagementPort, ip_address]}
228       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
229       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
230
231   NetworkDeployment:
232     type: OS::TripleO::SoftwareDeployment
233     properties:
234       name: NetworkDeployment
235       config: {get_resource: NetworkConfig}
236       server: {get_resource: {{role}}}
237       actions: {get_param: NetworkDeploymentActions}
238
239   {{role}}Deployment:
240     type: OS::Heat::StructuredDeployment
241     depends_on: NetworkDeployment
242     properties:
243       name: {{role}}Deployment
244       config: {get_resource: {{role}}Config}
245       server: {get_resource: {{role}}}
246       input_values:
247         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
248
249   {{role}}Config:
250     type: OS::Heat::StructuredConfig
251     properties:
252       group: os-apply-config
253       config:
254         hiera:
255           hierarchy:
256             - '"%{::uuid}"'
257             - heat_config_%{::deploy_config_name}
258             - {{role.lower()}}_extraconfig
259             - extraconfig
260             - service_names
261             - service_configs
262             - {{role.lower()}}
263             - bootstrap_node # provided by allNodesConfig
264             - all_nodes # provided by allNodesConfig
265             - vip_data # provided by allNodesConfig
266             - '"%{::osfamily}"'
267           merge_behavior: deeper
268           datafiles:
269             service_names:
270               mapped_data:
271                 service_names: {get_param: ServiceNames}
272                 sensu::subscriptions: {get_param: MonitoringSubscriptions}
273             service_configs:
274               mapped_data:
275                 map_replace:
276                   - {get_param: ServiceConfigSettings}
277                   - values: {get_attr: [NetIpMap, net_ip_map]}
278             {{role.lower()}}_extraconfig:
279               mapped_data: {get_param: {{role}}ExtraConfig}
280             extraconfig:
281               mapped_data: {get_param: ExtraConfig}
282             {{role.lower()}}:
283               mapped_data:
284                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
285                 tripleo::profile::base::logging::fluentd::fluentd_sources: {get_param: LoggingSources}
286                 tripleo::profile::base::logging::fluentd::fluentd_groups: {get_param: LoggingGroups}
287
288   # Resource for site-specific injection of root certificate
289   NodeTLSCAData:
290     depends_on: {{role}}Deployment
291     type: OS::TripleO::NodeTLSCAData
292     properties:
293       server: {get_resource: {{role}}}
294
295   # Hook for site-specific additional pre-deployment config, e.g extra hieradata
296   {{role}}ExtraConfigPre:
297     depends_on: {{role}}Deployment
298     type: OS::TripleO::{{role}}ExtraConfigPre
299     properties:
300         server: {get_resource: {{role}}}
301
302   # Hook for site-specific additional pre-deployment config,
303   # applying to all nodes, e.g node registration/unregistration
304   NodeExtraConfig:
305     depends_on: [{{role}}ExtraConfigPre, NodeTLSCAData]
306     type: OS::TripleO::NodeExtraConfig
307     properties:
308         server: {get_resource: {{role}}}
309
310   UpdateConfig:
311     type: OS::TripleO::Tasks::PackageUpdate
312
313   UpdateDeployment:
314     type: OS::Heat::SoftwareDeployment
315     properties:
316       config: {get_resource: UpdateConfig}
317       server: {get_resource: {{role}}}
318       input_values:
319         update_identifier:
320           get_param: UpdateIdentifier
321
322 outputs:
323   ip_address:
324     description: IP address of the server in the ctlplane network
325     value: {get_attr: [{{role}}, networks, ctlplane, 0]}
326   hostname:
327     description: Hostname of the server
328     value: {get_attr: [{{role}}, name]}
329   hostname_map:
330     description: Mapping of network names to hostnames
331     value:
332       external:
333         list_join:
334         - '.'
335         - - {get_attr: [{{role}}, name]}
336           - external
337           - {get_param: CloudDomain}
338       internal_api:
339         list_join:
340         - '.'
341         - - {get_attr: [{{role}}, name]}
342           - internalapi
343           - {get_param: CloudDomain}
344       storage:
345         list_join:
346         - '.'
347         - - {get_attr: [{{role}}, name]}
348           - storage
349           - {get_param: CloudDomain}
350       storage_mgmt:
351         list_join:
352         - '.'
353         - - {get_attr: [{{role}}, name]}
354           - storagemgmt
355           - {get_param: CloudDomain}
356       tenant:
357         list_join:
358         - '.'
359         - - {get_attr: [{{role}}, name]}
360           - tenant
361           - {get_param: CloudDomain}
362       management:
363         list_join:
364         - '.'
365         - - {get_attr: [{{role}}, name]}
366           - management
367           - {get_param: CloudDomain}
368       ctlplane:
369         list_join:
370         - '.'
371         - - {get_attr: [{{role}}, name]}
372           - ctlplane
373           - {get_param: CloudDomain}
374   hosts_entry:
375     value:
376       str_replace:
377         template: |
378           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
379           EXTERNALIP EXTERNALHOST.DOMAIN EXTERNALHOST
380           INTERNAL_APIIP INTERNAL_APIHOST.DOMAIN INTERNAL_APIHOST
381           STORAGEIP STORAGEHOST.DOMAIN STORAGEHOST
382           STORAGE_MGMTIP STORAGE_MGMTHOST.DOMAIN STORAGE_MGMTHOST
383           TENANTIP TENANTHOST.DOMAIN TENANTHOST
384           MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
385           CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
386         params:
387           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, {{role}}HostnameResolveNetwork]}]}
388           DOMAIN: {get_param: CloudDomain}
389           PRIMARYHOST: {get_attr: [{{role}}, name]}
390           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
391           EXTERNALHOST:
392             list_join:
393             - '.'
394             - - {get_attr: [{{role}}, name]}
395               - external
396           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
397           INTERNAL_APIHOST:
398             list_join:
399             - '.'
400             - - {get_attr: [{{role}}, name]}
401               - internalapi
402           STORAGEIP: {get_attr: [StoragePort, ip_address]}
403           STORAGEHOST:
404             list_join:
405             - '.'
406             - - {get_attr: [{{role}}, name]}
407               - storage
408           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
409           STORAGE_MGMTHOST:
410             list_join:
411             - '.'
412             - - {get_attr: [{{role}}, name]}
413               - storagemgmt
414           TENANTIP: {get_attr: [TenantPort, ip_address]}
415           TENANTHOST:
416             list_join:
417             - '.'
418             - - {get_attr: [{{role}}, name]}
419               - tenant
420           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
421           MANAGEMENTHOST:
422             list_join:
423             - '.'
424             - - {get_attr: [{{role}}, name]}
425               - management
426           CTLPLANEIP: {get_attr: [{{role}}, networks, ctlplane, 0]}
427           CTLPLANEHOST:
428             list_join:
429             - '.'
430             - - {get_attr: [{{role}}, name]}
431               - ctlplane
432   nova_server_resource:
433     description: Heat resource handle for {{role}} server
434     value:
435       {get_resource: {{role}}}
436   external_ip_address:
437     description: IP address of the server in the external network
438     value: {get_attr: [ExternalPort, ip_address]}
439   internal_api_ip_address:
440     description: IP address of the server in the internal_api network
441     value: {get_attr: [InternalApiPort, ip_address]}
442   storage_ip_address:
443     description: IP address of the server in the storage network
444     value: {get_attr: [StoragePort, ip_address]}
445   storage_mgmt_ip_address:
446     description: IP address of the server in the storage_mgmt network
447     value: {get_attr: [StorageMgmtPort, ip_address]}
448   tenant_ip_address:
449     description: IP address of the server in the tenant network
450     value: {get_attr: [TenantPort, ip_address]}
451   management_ip_address:
452     description: IP address of the server in the management network
453     value: {get_attr: [ManagementPort, ip_address]}