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