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