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