Merge "Use correct password for keystone bootstrap"
[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             - bootstrap_node # provided by allNodesConfig
263             - all_nodes # provided by allNodesConfig
264             - vip_data # provided by allNodesConfig
265             - '"%{::osfamily}"'
266           merge_behavior: deeper
267           datafiles:
268             service_names:
269               mapped_data:
270                 service_names: {get_param: ServiceNames}
271                 sensu::subscriptions: {get_param: MonitoringSubscriptions}
272             service_configs:
273               mapped_data:
274                 map_replace:
275                   - {get_param: ServiceConfigSettings}
276                   - values: {get_attr: [NetIpMap, net_ip_map]}
277             {{role.lower()}}_extraconfig:
278               mapped_data: {get_param: {{role}}ExtraConfig}
279             extraconfig:
280               mapped_data: {get_param: ExtraConfig}
281             {{role.lower()}}:
282               mapped_data:
283                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
284                 tripleo::profile::base::logging::fluentd::fluentd_sources: {get_param: LoggingSources}
285                 tripleo::profile::base::logging::fluentd::fluentd_groups: {get_param: LoggingGroups}
286
287   # Resource for site-specific injection of root certificate
288   NodeTLSCAData:
289     depends_on: {{role}}Deployment
290     type: OS::TripleO::NodeTLSCAData
291     properties:
292       server: {get_resource: {{role}}}
293
294   # Hook for site-specific additional pre-deployment config, e.g extra hieradata
295   {{role}}ExtraConfigPre:
296     depends_on: {{role}}Deployment
297     type: OS::TripleO::{{role}}ExtraConfigPre
298     properties:
299         server: {get_resource: {{role}}}
300
301   # Hook for site-specific additional pre-deployment config,
302   # applying to all nodes, e.g node registration/unregistration
303   NodeExtraConfig:
304     depends_on: [{{role}}ExtraConfigPre, NodeTLSCAData]
305     type: OS::TripleO::NodeExtraConfig
306     properties:
307         server: {get_resource: {{role}}}
308
309   UpdateConfig:
310     type: OS::TripleO::Tasks::PackageUpdate
311
312   UpdateDeployment:
313     type: OS::Heat::SoftwareDeployment
314     properties:
315       config: {get_resource: UpdateConfig}
316       server: {get_resource: {{role}}}
317       input_values:
318         update_identifier:
319           get_param: UpdateIdentifier
320
321 outputs:
322   ip_address:
323     description: IP address of the server in the ctlplane network
324     value: {get_attr: [{{role}}, networks, ctlplane, 0]}
325   hostname:
326     description: Hostname of the server
327     value: {get_attr: [{{role}}, name]}
328   hostname_map:
329     description: Mapping of network names to hostnames
330     value:
331       external:
332         list_join:
333         - '.'
334         - - {get_attr: [{{role}}, name]}
335           - external
336           - {get_param: CloudDomain}
337       internal_api:
338         list_join:
339         - '.'
340         - - {get_attr: [{{role}}, name]}
341           - internalapi
342           - {get_param: CloudDomain}
343       storage:
344         list_join:
345         - '.'
346         - - {get_attr: [{{role}}, name]}
347           - storage
348           - {get_param: CloudDomain}
349       storage_mgmt:
350         list_join:
351         - '.'
352         - - {get_attr: [{{role}}, name]}
353           - storagemgmt
354           - {get_param: CloudDomain}
355       tenant:
356         list_join:
357         - '.'
358         - - {get_attr: [{{role}}, name]}
359           - tenant
360           - {get_param: CloudDomain}
361       management:
362         list_join:
363         - '.'
364         - - {get_attr: [{{role}}, name]}
365           - management
366           - {get_param: CloudDomain}
367       ctlplane:
368         list_join:
369         - '.'
370         - - {get_attr: [{{role}}, name]}
371           - ctlplane
372           - {get_param: CloudDomain}
373   hosts_entry:
374     value:
375       str_replace:
376         template: |
377           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
378           EXTERNALIP EXTERNALHOST.DOMAIN EXTERNALHOST
379           INTERNAL_APIIP INTERNAL_APIHOST.DOMAIN INTERNAL_APIHOST
380           STORAGEIP STORAGEHOST.DOMAIN STORAGEHOST
381           STORAGE_MGMTIP STORAGE_MGMTHOST.DOMAIN STORAGE_MGMTHOST
382           TENANTIP TENANTHOST.DOMAIN TENANTHOST
383           MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
384           CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
385         params:
386           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, {{role}}HostnameResolveNetwork]}]}
387           DOMAIN: {get_param: CloudDomain}
388           PRIMARYHOST: {get_attr: [{{role}}, name]}
389           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
390           EXTERNALHOST:
391             list_join:
392             - '.'
393             - - {get_attr: [{{role}}, name]}
394               - external
395           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
396           INTERNAL_APIHOST:
397             list_join:
398             - '.'
399             - - {get_attr: [{{role}}, name]}
400               - internalapi
401           STORAGEIP: {get_attr: [StoragePort, ip_address]}
402           STORAGEHOST:
403             list_join:
404             - '.'
405             - - {get_attr: [{{role}}, name]}
406               - storage
407           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
408           STORAGE_MGMTHOST:
409             list_join:
410             - '.'
411             - - {get_attr: [{{role}}, name]}
412               - storagemgmt
413           TENANTIP: {get_attr: [TenantPort, ip_address]}
414           TENANTHOST:
415             list_join:
416             - '.'
417             - - {get_attr: [{{role}}, name]}
418               - tenant
419           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
420           MANAGEMENTHOST:
421             list_join:
422             - '.'
423             - - {get_attr: [{{role}}, name]}
424               - management
425           CTLPLANEIP: {get_attr: [{{role}}, networks, ctlplane, 0]}
426           CTLPLANEHOST:
427             list_join:
428             - '.'
429             - - {get_attr: [{{role}}, name]}
430               - ctlplane
431   nova_server_resource:
432     description: Heat resource handle for {{role}} server
433     value:
434       {get_resource: {{role}}}
435   external_ip_address:
436     description: IP address of the server in the external network
437     value: {get_attr: [ExternalPort, ip_address]}
438   internal_api_ip_address:
439     description: IP address of the server in the internal_api network
440     value: {get_attr: [InternalApiPort, ip_address]}
441   storage_ip_address:
442     description: IP address of the server in the storage network
443     value: {get_attr: [StoragePort, ip_address]}
444   storage_mgmt_ip_address:
445     description: IP address of the server in the storage_mgmt network
446     value: {get_attr: [StorageMgmtPort, ip_address]}
447   tenant_ip_address:
448     description: IP address of the server in the tenant network
449     value: {get_attr: [TenantPort, ip_address]}
450   management_ip_address:
451     description: IP address of the server in the management network
452     value: {get_attr: [ManagementPort, ip_address]}