Merge "Adds missing firewall rules for OpenDaylight API service"
[apex-tripleo-heat-templates.git] / puppet / blockstorage-role.yaml
1 heat_template_version: ocata
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   ServiceMetadataSettings:
106     type: json
107     default: {}
108   ConfigCommand:
109     type: string
110     description: Command which will be run whenever configuration data changes
111     default: os-refresh-config --timeout 14400
112   UpgradeInitCommand:
113     type: string
114     description: |
115       Command or script snippet to run on all overcloud nodes to
116       initialize the upgrade process. E.g. a repository switch.
117     default: ''
118
119 resources:
120   BlockStorage:
121     type: OS::TripleO::Server
122     metadata:
123       os-collect-config:
124         command: {get_param: ConfigCommand}
125     properties:
126       image:
127         {get_param: BlockStorageImage}
128       flavor: {get_param: OvercloudBlockStorageFlavor}
129       key_name: {get_param: KeyName}
130       networks:
131         - network: ctlplane
132       user_data_format: SOFTWARE_CONFIG
133       user_data: {get_resource: UserData}
134       name:
135         str_replace:
136             template: {get_param: Hostname}
137             params: {get_param: HostnameMap}
138       software_config_transport: {get_param: SoftwareConfigTransport}
139       metadata:
140         map_merge:
141           - {get_param: ServerMetadata}
142           - {get_param: BlockStorageServerMetadata}
143           - {get_param: ServiceMetadataSettings}
144       scheduler_hints: {get_param: BlockStorageSchedulerHints}
145
146   # Combine the NodeAdminUserData and NodeUserData mime archives
147   UserData:
148     type: OS::Heat::MultipartMime
149     properties:
150       parts:
151       - config: {get_resource: NodeAdminUserData}
152         type: multipart
153       - config: {get_resource: NodeUserData}
154         type: multipart
155       - config: {get_resource: RoleUserData}
156         type: multipart
157
158   # Creates the "heat-admin" user if configured via the environment
159   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
160   NodeAdminUserData:
161     type: OS::TripleO::NodeAdminUserData
162
163   # For optional operator additional userdata
164   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
165   NodeUserData:
166     type: OS::TripleO::NodeUserData
167
168   # For optional operator role-specific userdata
169   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
170   RoleUserData:
171     type: OS::TripleO::BlockStorage::NodeUserData
172
173   ExternalPort:
174     type: OS::TripleO::BlockStorage::Ports::ExternalPort
175     properties:
176       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
177       IPPool: {get_param: BlockStorageIPs}
178       NodeIndex: {get_param: NodeIndex}
179
180   InternalApiPort:
181     type: OS::TripleO::BlockStorage::Ports::InternalApiPort
182     properties:
183       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
184       IPPool: {get_param: BlockStorageIPs}
185       NodeIndex: {get_param: NodeIndex}
186
187   StoragePort:
188     type: OS::TripleO::BlockStorage::Ports::StoragePort
189     properties:
190       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
191       IPPool: {get_param: BlockStorageIPs}
192       NodeIndex: {get_param: NodeIndex}
193
194   StorageMgmtPort:
195     type: OS::TripleO::BlockStorage::Ports::StorageMgmtPort
196     properties:
197       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
198       IPPool: {get_param: BlockStorageIPs}
199       NodeIndex: {get_param: NodeIndex}
200
201   TenantPort:
202     type: OS::TripleO::BlockStorage::Ports::TenantPort
203     properties:
204       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
205       IPPool: {get_param: BlockStorageIPs}
206       NodeIndex: {get_param: NodeIndex}
207
208   ManagementPort:
209     type: OS::TripleO::BlockStorage::Ports::ManagementPort
210     properties:
211       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
212       IPPool: {get_param: BlockStorageIPs}
213       NodeIndex: {get_param: NodeIndex}
214
215   NetworkConfig:
216     type: OS::TripleO::BlockStorage::Net::SoftwareConfig
217     properties:
218       ControlPlaneIp: {get_attr: [BlockStorage, networks, ctlplane, 0]}
219       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
220       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
221       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
222       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
223       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
224       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
225
226   NetIpMap:
227     type: OS::TripleO::Network::Ports::NetIpMap
228     properties:
229       ControlPlaneIp: {get_attr: [BlockStorage, networks, ctlplane, 0]}
230       ExternalIp: {get_attr: [ExternalPort, ip_address]}
231       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
232       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
233       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
234       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
235       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
236       StorageIp: {get_attr: [StoragePort, ip_address]}
237       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
238       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
239       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
240       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
241       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
242       TenantIp: {get_attr: [TenantPort, ip_address]}
243       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
244       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
245       ManagementIp: {get_attr: [ManagementPort, ip_address]}
246       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
247       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
248
249   NetHostMap:
250     type: OS::Heat::Value
251     properties:
252       type: json
253       value:
254         external:
255           fqdn:
256             list_join:
257             - '.'
258             - - {get_attr: [BlockStorage, name]}
259               - external
260               - {get_param: CloudDomain}
261           short:
262             list_join:
263             - '.'
264             - - {get_attr: [BlockStorage, name]}
265               - external
266         internal_api:
267           fqdn:
268             list_join:
269             - '.'
270             - - {get_attr: [BlockStorage, name]}
271               - internalapi
272               - {get_param: CloudDomain}
273           short:
274             list_join:
275             - '.'
276             - - {get_attr: [BlockStorage, name]}
277               - internalapi
278         storage:
279           fqdn:
280             list_join:
281             - '.'
282             - - {get_attr: [BlockStorage, name]}
283               - storage
284               - {get_param: CloudDomain}
285           short:
286             list_join:
287             - '.'
288             - - {get_attr: [BlockStorage, name]}
289               - storage
290         storage_mgmt:
291           fqdn:
292             list_join:
293             - '.'
294             - - {get_attr: [BlockStorage, name]}
295               - storagemgmt
296               - {get_param: CloudDomain}
297           short:
298             list_join:
299             - '.'
300             - - {get_attr: [BlockStorage, name]}
301               - storagemgmt
302         tenant:
303           fqdn:
304             list_join:
305             - '.'
306             - - {get_attr: [BlockStorage, name]}
307               - tenant
308               - {get_param: CloudDomain}
309           short:
310             list_join:
311             - '.'
312             - - {get_attr: [BlockStorage, name]}
313               - tenant
314         management:
315           fqdn:
316             list_join:
317             - '.'
318             - - {get_attr: [BlockStorage, name]}
319               - management
320               - {get_param: CloudDomain}
321           short:
322             list_join:
323             - '.'
324             - - {get_attr: [BlockStorage, name]}
325               - management
326         ctlplane:
327           fqdn:
328             list_join:
329             - '.'
330             - - {get_attr: [BlockStorage, name]}
331               - ctlplane
332               - {get_param: CloudDomain}
333           short:
334             list_join:
335             - '.'
336             - - {get_attr: [BlockStorage, name]}
337               - ctlplane
338
339   NetworkDeployment:
340     type: OS::TripleO::SoftwareDeployment
341     properties:
342       name: NetworkDeployment
343       config: {get_resource: NetworkConfig}
344       server: {get_resource: BlockStorage}
345       actions: {get_param: NetworkDeploymentActions}
346
347   BlockStorageUpgradeInitConfig:
348     type: OS::Heat::SoftwareConfig
349     properties:
350       group: script
351       config:
352         list_join:
353         - ''
354         - - "#!/bin/bash\n\n"
355           - "if [[ -f /etc/resolv.conf.save ]] ; then rm /etc/resolv.conf.save; fi\n\n"
356           - get_param: UpgradeInitCommand
357
358   # Note we may be able to make this conditional on UpgradeInitCommandNotEmpty
359   # but https://bugs.launchpad.net/heat/+bug/1649900 needs fixing first
360   BlockStorageUpgradeInitDeployment:
361     type: OS::Heat::SoftwareDeployment
362     depends_on: NetworkDeployment
363     properties:
364       name: BlockStorageUpgradeInitDeployment
365       server: {get_resource: BlockStorage}
366       config: {get_resource: BlockStorageUpgradeInitConfig}
367
368   BlockStorageDeployment:
369     type: OS::Heat::StructuredDeployment
370     depends_on: BlockStorageUpgradeInitDeployment
371     properties:
372       name: BlockStorageDeployment
373       server: {get_resource: BlockStorage}
374       config: {get_resource: BlockStorageConfig}
375       input_values:
376         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
377
378   # Map heat metadata into hiera datafiles
379   BlockStorageConfig:
380     type: OS::Heat::StructuredConfig
381     properties:
382       group: hiera
383       config:
384         hierarchy:
385           - '"%{::uuid}"'
386           - heat_config_%{::deploy_config_name}
387           - volume_extraconfig
388           - extraconfig
389           - service_names
390           - service_configs
391           - volume
392           - bootstrap_node # provided by allNodesConfig
393           - all_nodes # provided by allNodesConfig
394           - vip_data # provided by allNodesConfig
395           - '"%{::osfamily}"'
396         merge_behavior: deeper
397         datafiles:
398           service_names:
399             service_names: {get_param: ServiceNames}
400             sensu::subscriptions: {get_param: MonitoringSubscriptions}
401           service_configs:
402             map_replace:
403               - {get_param: ServiceConfigSettings}
404               - values: {get_attr: [NetIpMap, net_ip_map]}
405           volume_extraconfig: {get_param: BlockStorageExtraConfig}
406           extraconfig: {get_param: ExtraConfig}
407           volume:
408             tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
409             fqdn_internal_api: {get_attr: [NetHostMap, value, internal_api, fqdn]}
410             fqdn_storage: {get_attr: [NetHostMap, value, storage, fqdn]}
411             fqdn_storage_mgmt: {get_attr: [NetHostMap, value, storage_mgmt, fqdn]}
412             fqdn_tenant: {get_attr: [NetHostMap, value, tenant, fqdn]}
413             fqdn_management: {get_attr: [NetHostMap, value, management, fqdn]}
414             fqdn_ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
415
416   # Resource for site-specific injection of root certificate
417   NodeTLSCAData:
418     depends_on: BlockStorageDeployment
419     type: OS::TripleO::NodeTLSCAData
420     properties:
421       server: {get_resource: BlockStorage}
422
423   # Hook for site-specific additional pre-deployment config,
424   # applying to all nodes, e.g node registration/unregistration
425   NodeExtraConfig:
426     depends_on: NodeTLSCAData
427     type: OS::TripleO::NodeExtraConfig
428     properties:
429         server: {get_resource: BlockStorage}
430
431   UpdateConfig:
432     type: OS::TripleO::Tasks::PackageUpdate
433
434   UpdateDeployment:
435     type: OS::Heat::SoftwareDeployment
436     properties:
437       name: UpdateDeployment
438       config: {get_resource: UpdateConfig}
439       server: {get_resource: BlockStorage}
440       input_values:
441         update_identifier:
442           get_param: UpdateIdentifier
443
444 outputs:
445   ip_address:
446     description: IP address of the server in the ctlplane network
447     value: {get_attr: [BlockStorage, networks, ctlplane, 0]}
448   hostname:
449     description: Hostname of the server
450     value: {get_attr: [BlockStorage, name]}
451   hostname_map:
452     description: Mapping of network names to hostnames
453     value:
454       external: {get_attr: [NetHostMap, value, external, fqdn]}
455       internal_api: {get_attr: [NetHostMap, value, internal_api, fqdn]}
456       storage: {get_attr: [NetHostMap, value, storage, fqdn]}
457       storage_mgmt: {get_attr: [NetHostMap, value, storage_mgmt, fqdn]}
458       tenant: {get_attr: [NetHostMap, value, tenant, fqdn]}
459       management: {get_attr: [NetHostMap, value, management, fqdn]}
460       ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
461   hosts_entry:
462     value:
463       str_replace:
464         template: |
465           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
466           EXTERNALIP EXTERNALHOST.DOMAIN EXTERNALHOST
467           INTERNAL_APIIP INTERNAL_APIHOST.DOMAIN INTERNAL_APIHOST
468           STORAGEIP STORAGEHOST.DOMAIN STORAGEHOST
469           STORAGE_MGMTIP STORAGE_MGMTHOST.DOMAIN STORAGE_MGMTHOST
470           TENANTIP TENANTHOST.DOMAIN TENANTHOST
471           MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
472           CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
473         params:
474           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, BlockStorageHostnameResolveNetwork]}]}
475           DOMAIN: {get_param: CloudDomain}
476           PRIMARYHOST: {get_attr: [BlockStorage, name]}
477           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
478           EXTERNALHOST: {get_attr: [NetHostMap, value, external, short]}
479           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
480           INTERNAL_APIHOST: {get_attr: [NetHostMap, value, internal_api, short]}
481           STORAGEIP: {get_attr: [StoragePort, ip_address]}
482           STORAGEHOST: {get_attr: [NetHostMap, value, storage, short]}
483           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
484           STORAGE_MGMTHOST: {get_attr: [NetHostMap, value, storage_mgmt, short]}
485           TENANTIP: {get_attr: [TenantPort, ip_address]}
486           TENANTHOST: {get_attr: [NetHostMap, value, tenant, short]}
487           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
488           MANAGEMENTHOST: {get_attr: [NetHostMap, value, management, short]}
489           CTLPLANEIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
490           CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
491   nova_server_resource:
492     description: Heat resource handle for the block storage server
493     value:
494       {get_resource: BlockStorage}
495   external_ip_address:
496     description: IP address of the server in the external network
497     value: {get_attr: [ExternalPort, ip_address]}
498   internal_api_ip_address:
499     description: IP address of the server in the internal_api network
500     value: {get_attr: [InternalApiPort, ip_address]}
501   storage_ip_address:
502     description: IP address of the server in the storage network
503     value: {get_attr: [StoragePort, ip_address]}
504   storage_mgmt_ip_address:
505     description: IP address of the server in the storage_mgmt network
506     value: {get_attr: [StorageMgmtPort, ip_address]}
507   tenant_ip_address:
508     description: IP address of the server in the tenant network
509     value: {get_attr: [TenantPort, ip_address]}
510   management_ip_address:
511     description: IP address of the server in the management network
512     value: {get_attr: [ManagementPort, ip_address]}