Merge "Increase libvirt/qemu.conf max_files and max_processes"
[apex-tripleo-heat-templates.git] / puppet / objectstorage-role.yaml
1 heat_template_version: ocata
2 description: 'OpenStack swift storage node configured by Puppet'
3 parameters:
4   OvercloudSwiftStorageFlavor:
5     description: Flavor for Swift storage nodes to request when deploying.
6     default: baremetal
7     type: string
8     constraints:
9       - custom_constraint: nova.flavor
10   SwiftStorageImage:
11     default: overcloud-full
12     type: string
13     constraints:
14       - custom_constraint: glance.image
15   KeyName:
16     default: default
17     description: Name of an existing Nova key pair to enable SSH access to the instances
18     type: string
19   UpdateIdentifier:
20     default: ''
21     type: string
22     description: >
23       Setting to a previously unused value during stack-update will trigger
24       package update on all nodes
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   Hostname:
36     type: string
37     default: '' # Defaults to Heat created hostname
38   HostnameMap:
39     type: json
40     default: {}
41     description: Optional mapping to override hostnames
42   ExtraConfig:
43     default: {}
44     description: |
45       Additional hiera configuration to inject into the cluster. Note
46       that ObjectStorageExtraConfig takes precedence over ExtraConfig.
47     type: json
48   ObjectStorageExtraConfig:
49     default: {}
50     description: |
51       Role specific additional hiera configuration to inject into the cluster.
52     type: json
53   SwiftStorageIPs:
54     default: {}
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   SwiftStorageServerMetadata:
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   ObjectStorageSchedulerHints:
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
119 resources:
120
121   SwiftStorage:
122     type: OS::Nova::Server
123     metadata:
124       os-collect-config:
125         command: {get_param: ConfigCommand}
126     properties:
127       image: {get_param: SwiftStorageImage}
128       flavor: {get_param: OvercloudSwiftStorageFlavor}
129       key_name: {get_param: KeyName}
130       networks:
131         - network: ctlplane
132       user_data_format: SOFTWARE_CONFIG
133       user_data: {get_resource: UserData}
134       name:
135         str_replace:
136             template: {get_param: Hostname}
137             params: {get_param: HostnameMap}
138       software_config_transport: {get_param: SoftwareConfigTransport}
139       metadata:
140         map_merge:
141           - {get_param: ServerMetadata}
142           - {get_param: SwiftStorageServerMetadata}
143           - {get_param: ServiceMetadataSettings}
144       scheduler_hints: {get_param: ObjectStorageSchedulerHints}
145
146   # Combine the NodeAdminUserData and NodeUserData mime archives
147   UserData:
148     type: OS::Heat::MultipartMime
149     properties:
150       parts:
151       - config: {get_resource: NodeAdminUserData}
152         type: multipart
153       - config: {get_resource: NodeUserData}
154         type: multipart
155       - config: {get_resource: RoleUserData}
156         type: multipart
157
158   # Creates the "heat-admin" user if configured via the environment
159   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
160   NodeAdminUserData:
161     type: OS::TripleO::NodeAdminUserData
162
163   # For optional operator additional userdata
164   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
165   NodeUserData:
166     type: OS::TripleO::NodeUserData
167
168   # For optional operator role-specific userdata
169   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
170   RoleUserData:
171     type: OS::TripleO::ObjectStorage::NodeUserData
172
173   ExternalPort:
174     type: OS::TripleO::SwiftStorage::Ports::ExternalPort
175     properties:
176       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
177       IPPool: {get_param: SwiftStorageIPs}
178       NodeIndex: {get_param: NodeIndex}
179
180   InternalApiPort:
181     type: OS::TripleO::SwiftStorage::Ports::InternalApiPort
182     properties:
183       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
184       IPPool: {get_param: SwiftStorageIPs}
185       NodeIndex: {get_param: NodeIndex}
186
187   StoragePort:
188     type: OS::TripleO::SwiftStorage::Ports::StoragePort
189     properties:
190       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
191       IPPool: {get_param: SwiftStorageIPs}
192       NodeIndex: {get_param: NodeIndex}
193
194   StorageMgmtPort:
195     type: OS::TripleO::SwiftStorage::Ports::StorageMgmtPort
196     properties:
197       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
198       IPPool: {get_param: SwiftStorageIPs}
199       NodeIndex: {get_param: NodeIndex}
200
201   TenantPort:
202     type: OS::TripleO::SwiftStorage::Ports::TenantPort
203     properties:
204       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
205       IPPool: {get_param: SwiftStorageIPs}
206       NodeIndex: {get_param: NodeIndex}
207
208   ManagementPort:
209     type: OS::TripleO::SwiftStorage::Ports::ManagementPort
210     properties:
211       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
212       IPPool: {get_param: SwiftStorageIPs}
213       NodeIndex: {get_param: NodeIndex}
214
215   NetworkConfig:
216     type: OS::TripleO::ObjectStorage::Net::SoftwareConfig
217     properties:
218       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
219       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
220       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
221       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
222       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
223       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
224       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
225
226   NetIpMap:
227     type: OS::TripleO::Network::Ports::NetIpMap
228     properties:
229       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
230       ExternalIp: {get_attr: [ExternalPort, ip_address]}
231       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
232       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
233       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
234       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
235       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
236       StorageIp: {get_attr: [StoragePort, ip_address]}
237       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
238       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
239       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
240       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
241       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
242       TenantIp: {get_attr: [TenantPort, ip_address]}
243       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
244       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
245       ManagementIp: {get_attr: [ManagementPort, ip_address]}
246       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
247       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
248
249   NetHostMap:
250     type: OS::Heat::Value
251     properties:
252       type: json
253       value:
254         external:
255           fqdn:
256             list_join:
257             - '.'
258             - - {get_attr: [SwiftStorage, name]}
259               - external
260               - {get_param: CloudDomain}
261           short:
262             list_join:
263             - '.'
264             - - {get_attr: [SwiftStorage, name]}
265               - external
266         internal_api:
267           fqdn:
268             list_join:
269             - '.'
270             - - {get_attr: [SwiftStorage, name]}
271               - internalapi
272               - {get_param: CloudDomain}
273           short:
274             list_join:
275             - '.'
276             - - {get_attr: [SwiftStorage, name]}
277               - internalapi
278         storage:
279           fqdn:
280             list_join:
281             - '.'
282             - - {get_attr: [SwiftStorage, name]}
283               - storage
284               - {get_param: CloudDomain}
285           short:
286             list_join:
287             - '.'
288             - - {get_attr: [SwiftStorage, name]}
289               - storage
290         storage_mgmt:
291           fqdn:
292             list_join:
293             - '.'
294             - - {get_attr: [SwiftStorage, name]}
295               - storagemgmt
296               - {get_param: CloudDomain}
297           short:
298             list_join:
299             - '.'
300             - - {get_attr: [SwiftStorage, name]}
301               - storagemgmt
302         tenant:
303           fqdn:
304             list_join:
305             - '.'
306             - - {get_attr: [SwiftStorage, name]}
307               - tenant
308               - {get_param: CloudDomain}
309           short:
310             list_join:
311             - '.'
312             - - {get_attr: [SwiftStorage, name]}
313               - tenant
314         management:
315           fqdn:
316             list_join:
317             - '.'
318             - - {get_attr: [SwiftStorage, name]}
319               - management
320               - {get_param: CloudDomain}
321           short:
322             list_join:
323             - '.'
324             - - {get_attr: [SwiftStorage, name]}
325               - management
326         ctlplane:
327           fqdn:
328             list_join:
329             - '.'
330             - - {get_attr: [SwiftStorage, name]}
331               - ctlplane
332               - {get_param: CloudDomain}
333           short:
334             list_join:
335             - '.'
336             - - {get_attr: [SwiftStorage, name]}
337               - ctlplane
338
339   NetworkDeployment:
340     type: OS::TripleO::SoftwareDeployment
341     properties:
342       name: NetworkDeployment
343       config: {get_resource: NetworkConfig}
344       server: {get_resource: SwiftStorage}
345       actions: {get_param: NetworkDeploymentActions}
346
347   SwiftStorageUpgradeInitConfig:
348     type: OS::Heat::SoftwareConfig
349     properties:
350       group: script
351       config:
352         list_join:
353         - ''
354         - - "#!/bin/bash\n\n"
355           - "if [[ -f /etc/resolv.conf.save ]] ; then rm /etc/resolv.conf.save; fi\n\n"
356           - get_param: UpgradeInitCommand
357
358   # Note we may be able to make this conditional on UpgradeInitCommandNotEmpty
359   # but https://bugs.launchpad.net/heat/+bug/1649900 needs fixing first
360   SwiftStorageUpgradeInitDeployment:
361     type: OS::Heat::SoftwareDeployment
362     depends_on: NetworkDeployment
363     properties:
364       name: SwiftStorageUpgradeInitDeployment
365       server: {get_resource: SwiftStorage}
366       config: {get_resource: SwiftStorageUpgradeInitConfig}
367
368   SwiftStorageHieraConfig:
369     type: OS::Heat::StructuredConfig
370     properties:
371       group: hiera
372       config:
373         hierarchy:
374           - '"%{::uuid}"'
375           - heat_config_%{::deploy_config_name}
376           - object_extraconfig
377           - extraconfig
378           - service_names
379           - service_configs
380           - object
381           - bootstrap_node # provided by allNodesConfig
382           - all_nodes # provided by allNodesConfig
383           - vip_data # provided by allNodesConfig
384           - '"%{::osfamily}"'
385         merge_behavior: deeper
386         datafiles:
387           service_names:
388             service_names: {get_param: ServiceNames}
389             sensu::subscriptions: {get_param: MonitoringSubscriptions}
390           service_configs:
391             map_replace:
392               - {get_param: ServiceConfigSettings}
393               - values: {get_attr: [NetIpMap, net_ip_map]}
394           object_extraconfig: {get_param: ObjectStorageExtraConfig}
395           extraconfig: {get_param: ExtraConfig}
396           object:
397             tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
398             fqdn_internal_api: {get_attr: [NetHostMap, value, internal_api, fqdn]}
399             fqdn_storage: {get_attr: [NetHostMap, value, storage, fqdn]}
400             fqdn_storage_mgmt: {get_attr: [NetHostMap, value, storage_mgmt, fqdn]}
401             fqdn_tenant: {get_attr: [NetHostMap, value, tenant, fqdn]}
402             fqdn_management: {get_attr: [NetHostMap, value, management, fqdn]}
403             fqdn_ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
404
405   SwiftStorageHieraDeploy:
406     type: OS::Heat::StructuredDeployment
407     depends_on: SwiftStorageUpgradeInitDeployment
408     properties:
409       name: SwiftStorageHieraDeploy
410       server: {get_resource: SwiftStorage}
411       config: {get_resource: SwiftStorageHieraConfig}
412       input_values:
413         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
414
415   # Resource for site-specific injection of root certificate
416   NodeTLSCAData:
417     depends_on: SwiftStorageHieraDeploy
418     type: OS::TripleO::NodeTLSCAData
419     properties:
420       server: {get_resource: SwiftStorage}
421
422   # Hook for site-specific additional pre-deployment config,
423   # applying to all nodes, e.g node registration/unregistration
424   NodeExtraConfig:
425     depends_on: NodeTLSCAData
426     type: OS::TripleO::NodeExtraConfig
427     properties:
428         server: {get_resource: SwiftStorage}
429
430   UpdateConfig:
431     type: OS::TripleO::Tasks::PackageUpdate
432
433   UpdateDeployment:
434     type: OS::Heat::SoftwareDeployment
435     properties:
436       config: {get_resource: UpdateConfig}
437       server: {get_resource: SwiftStorage}
438       input_values:
439         update_identifier:
440           get_param: UpdateIdentifier
441
442 outputs:
443   ip_address:
444     description: IP address of the server in the ctlplane network
445     value: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
446   hostname:
447     description: Hostname of the server
448     value: {get_attr: [SwiftStorage, name]}
449   hostname_map:
450     description: Mapping of network names to hostnames
451     value:
452       external: {get_attr: [NetHostMap, value, external, fqdn]}
453       internal_api: {get_attr: [NetHostMap, value, internal_api, fqdn]}
454       storage: {get_attr: [NetHostMap, value, storage, fqdn]}
455       storage_mgmt: {get_attr: [NetHostMap, value, storage_mgmt, fqdn]}
456       tenant: {get_attr: [NetHostMap, value, tenant, fqdn]}
457       management: {get_attr: [NetHostMap, value, management, fqdn]}
458       ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
459   hosts_entry:
460     value:
461       str_replace:
462         template: |
463           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
464           EXTERNALIP EXTERNALHOST.DOMAIN EXTERNALHOST
465           INTERNAL_APIIP INTERNAL_APIHOST.DOMAIN INTERNAL_APIHOST
466           STORAGEIP STORAGEHOST.DOMAIN STORAGEHOST
467           STORAGE_MGMTIP STORAGE_MGMTHOST.DOMAIN STORAGE_MGMTHOST
468           TENANTIP TENANTHOST.DOMAIN TENANTHOST
469           MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
470           CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
471         params:
472           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ObjectStorageHostnameResolveNetwork]}]}
473           DOMAIN: {get_param: CloudDomain}
474           PRIMARYHOST: {get_attr: [SwiftStorage, name]}
475           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
476           EXTERNALHOST: {get_attr: [NetHostMap, value, external, short]}
477           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
478           INTERNAL_APIHOST: {get_attr: [NetHostMap, value, internal_api, short]}
479           STORAGEIP: {get_attr: [StoragePort, ip_address]}
480           STORAGEHOST: {get_attr: [NetHostMap, value, storage, short]}
481           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
482           STORAGE_MGMTHOST: {get_attr: [NetHostMap, value, storage_mgmt, short]}
483           TENANTIP: {get_attr: [TenantPort, ip_address]}
484           TENANTHOST: {get_attr: [NetHostMap, value, tenant, short]}
485           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
486           MANAGEMENTHOST: {get_attr: [NetHostMap, value, management, short]}
487           CTLPLANEIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
488           CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
489   nova_server_resource:
490     description: Heat resource handle for the swift storage server
491     value:
492       {get_resource: SwiftStorage}
493   external_ip_address:
494     description: IP address of the server in the external network
495     value: {get_attr: [ExternalPort, ip_address]}
496   internal_api_ip_address:
497     description: IP address of the server in the internal_api network
498     value: {get_attr: [InternalApiPort, ip_address]}
499   storage_ip_address:
500     description: IP address of the server in the storage network
501     value: {get_attr: [StoragePort, ip_address]}
502   storage_mgmt_ip_address:
503     description: IP address of the server in the storage_mgmt network
504     value: {get_attr: [StorageMgmtPort, ip_address]}
505   tenant_ip_address:
506     description: IP address of the server in the tenant network
507     value: {get_attr: [TenantPort, ip_address]}
508   management_ip_address:
509     description: IP address of the server in the management network
510     value: {get_attr: [ManagementPort, ip_address]}