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