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