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