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