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