Merge "Revert "Pin puppetlabs_spec_helper to 1.1.1""
[apex-tripleo-heat-templates.git] / puppet / swift-storage.yaml
1 heat_template_version: 2016-10-14
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   HashSuffix:
11     description: A random string to be used as a salt when hashing to determine mappings
12       in the ring.
13     hidden: true
14     type: string
15   SwiftStorageImage:
16     default: overcloud-full
17     type: string
18     constraints:
19       - custom_constraint: glance.image
20   KeyName:
21     default: default
22     description: Name of an existing Nova key pair to enable SSH access to the instances
23     type: string
24   SnmpdReadonlyUserName:
25     default: ro_snmp_user
26     description: The user name for SNMPd with readonly rights running on all Overcloud nodes
27     type: string
28   SnmpdReadonlyUserPassword:
29     description: The user password for SNMPd with readonly rights running on all Overcloud nodes
30     type: string
31     hidden: true
32   UpdateIdentifier:
33     default: ''
34     type: string
35     description: >
36       Setting to a previously unused value during stack-update will trigger
37       package update on all nodes
38   ServiceNetMap:
39     default: {}
40     description: Mapping of service_name -> network name. Typically set
41                  via parameter_defaults in the resource registry.
42     type: json
43   Hostname:
44     type: string
45     default: '' # Defaults to Heat created hostname
46   HostnameMap:
47     type: json
48     default: {}
49     description: Optional mapping to override hostnames
50   ExtraConfig:
51     default: {}
52     description: |
53       Additional hiera configuration to inject into the cluster. Note
54       that ObjectStorageExtraConfig takes precedence over ExtraConfig.
55     type: json
56   ObjectStorageExtraConfig:
57     default: {}
58     description: |
59       Role specific additional hiera configuration to inject into the cluster.
60     type: json
61   SwiftStorageIPs:
62     default: {}
63     type: json
64   NetworkDeploymentActions:
65     type: comma_delimited_list
66     description: >
67       Heat action when to apply network configuration changes
68     default: ['CREATE']
69   SoftwareConfigTransport:
70     default: POLL_SERVER_CFN
71     description: |
72       How the server should receive the metadata required for software configuration.
73     type: string
74     constraints:
75     - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
76   CloudDomain:
77     type: string
78     description: >
79       The DNS domain used for the hosts. This should match the dhcp_domain
80       configured in the Undercloud neutron. Defaults to localdomain.
81   ServerMetadata:
82     default: {}
83     description: >
84       Extra properties or metadata passed to Nova for the created nodes in
85       the overcloud. It's accessible via the Nova metadata API.
86     type: json
87   ObjectStorageSchedulerHints:
88     type: json
89     description: Optional scheduler hints to pass to nova
90     default: {}
91   NodeIndex:
92     type: number
93     default: 0
94   ServiceConfigSettings:
95     type: json
96     default: {}
97   ServiceNames:
98     type: comma_delimited_list
99     default: []
100   ConfigCommand:
101     type: string
102     description: Command which will be run whenever configuration data changes
103     default: os-refresh-config --timeout 14400
104
105 resources:
106
107   SwiftStorage:
108     type: OS::Nova::Server
109     metadata:
110       os-collect-config:
111         command: {get_param: ConfigCommand}
112     properties:
113       image: {get_param: SwiftStorageImage}
114       flavor: {get_param: OvercloudSwiftStorageFlavor}
115       key_name: {get_param: KeyName}
116       networks:
117         - network: ctlplane
118       user_data_format: SOFTWARE_CONFIG
119       user_data: {get_resource: UserData}
120       name:
121         str_replace:
122             template: {get_param: Hostname}
123             params: {get_param: HostnameMap}
124       software_config_transport: {get_param: SoftwareConfigTransport}
125       metadata: {get_param: ServerMetadata}
126       scheduler_hints: {get_param: ObjectStorageSchedulerHints}
127
128   # Combine the NodeAdminUserData and NodeUserData mime archives
129   UserData:
130     type: OS::Heat::MultipartMime
131     properties:
132       parts:
133       - config: {get_resource: NodeAdminUserData}
134         type: multipart
135       - config: {get_resource: NodeUserData}
136         type: multipart
137
138   # Creates the "heat-admin" user if configured via the environment
139   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
140   NodeAdminUserData:
141     type: OS::TripleO::NodeAdminUserData
142
143   # For optional operator additional userdata
144   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
145   NodeUserData:
146     type: OS::TripleO::NodeUserData
147
148   ExternalPort:
149     type: OS::TripleO::SwiftStorage::Ports::ExternalPort
150     properties:
151       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
152       IPPool: {get_param: SwiftStorageIPs}
153       NodeIndex: {get_param: NodeIndex}
154
155   InternalApiPort:
156     type: OS::TripleO::SwiftStorage::Ports::InternalApiPort
157     properties:
158       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
159       IPPool: {get_param: SwiftStorageIPs}
160       NodeIndex: {get_param: NodeIndex}
161
162   StoragePort:
163     type: OS::TripleO::SwiftStorage::Ports::StoragePort
164     properties:
165       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
166       IPPool: {get_param: SwiftStorageIPs}
167       NodeIndex: {get_param: NodeIndex}
168
169   StorageMgmtPort:
170     type: OS::TripleO::SwiftStorage::Ports::StorageMgmtPort
171     properties:
172       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
173       IPPool: {get_param: SwiftStorageIPs}
174       NodeIndex: {get_param: NodeIndex}
175
176   TenantPort:
177     type: OS::TripleO::SwiftStorage::Ports::TenantPort
178     properties:
179       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
180       IPPool: {get_param: SwiftStorageIPs}
181       NodeIndex: {get_param: NodeIndex}
182
183   ManagementPort:
184     type: OS::TripleO::SwiftStorage::Ports::ManagementPort
185     properties:
186       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
187       IPPool: {get_param: SwiftStorageIPs}
188       NodeIndex: {get_param: NodeIndex}
189
190   NetworkConfig:
191     type: OS::TripleO::ObjectStorage::Net::SoftwareConfig
192     properties:
193       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
194       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
195       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
196       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
197       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
198       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
199       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
200
201   NetIpMap:
202     type: OS::TripleO::Network::Ports::NetIpMap
203     properties:
204       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
205       ExternalIp: {get_attr: [ExternalPort, ip_address]}
206       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
207       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
208       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
209       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
210       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
211       StorageIp: {get_attr: [StoragePort, ip_address]}
212       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
213       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
214       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
215       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
216       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
217       TenantIp: {get_attr: [TenantPort, ip_address]}
218       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
219       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
220       ManagementIp: {get_attr: [ManagementPort, ip_address]}
221       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
222       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
223
224   NetworkDeployment:
225     type: OS::TripleO::SoftwareDeployment
226     properties:
227       name: NetworkDeployment
228       config: {get_resource: NetworkConfig}
229       server: {get_resource: SwiftStorage}
230       actions: {get_param: NetworkDeploymentActions}
231
232   SwiftStorageHieraConfig:
233     type: OS::Heat::StructuredConfig
234     properties:
235       group: os-apply-config
236       config:
237         hiera:
238           hierarchy:
239             - '"%{::uuid}"'
240             - heat_config_%{::deploy_config_name}
241             - object_extraconfig
242             - extraconfig
243             - service_names
244             - service_configs
245             - object
246             - swift_devices_and_proxy # provided by SwiftDevicesAndProxyConfig
247             - all_nodes # provided by allNodesConfig
248             - '"%{::osfamily}"'
249           merge_behavior: deeper
250           datafiles:
251             service_names:
252               mapped_data:
253                 service_names: {get_param: ServiceNames}
254             service_configs:
255               mapped_data:
256                 map_replace:
257                   - {get_param: ServiceConfigSettings}
258                   - values: {get_attr: [NetIpMap, net_ip_map]}
259             object_extraconfig:
260               mapped_data: {get_param: ObjectStorageExtraConfig}
261             extraconfig:
262               mapped_data: {get_param: ExtraConfig}
263             object:
264               mapped_data: # data supplied directly to this deployment configuration, etc
265                 swift::swift_hash_path_suffix: { get_input: swift_hash_suffix }
266                 swift::storage::all::storage_local_net_ip: {get_input: swift_management_network}
267                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
268                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
269                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
270
271
272   SwiftStorageHieraDeploy:
273     type: OS::Heat::StructuredDeployment
274     depends_on: NetworkDeployment
275     properties:
276       name: SwiftStorageHieraDeploy
277       server: {get_resource: SwiftStorage}
278       config: {get_resource: SwiftStorageHieraConfig}
279       input_values:
280         local_ip: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
281         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
282         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
283         swift_hash_suffix: {get_param: HashSuffix}
284         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
285         swift_management_network: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
286
287   # Resource for site-specific injection of root certificate
288   NodeTLSCAData:
289     depends_on: SwiftStorageHieraDeploy
290     type: OS::TripleO::NodeTLSCAData
291     properties:
292       server: {get_resource: SwiftStorage}
293
294   # Hook for site-specific additional pre-deployment config,
295   # applying to all nodes, e.g node registration/unregistration
296   NodeExtraConfig:
297     depends_on: NodeTLSCAData
298     type: OS::TripleO::NodeExtraConfig
299     properties:
300         server: {get_resource: SwiftStorage}
301
302   UpdateConfig:
303     type: OS::TripleO::Tasks::PackageUpdate
304
305   UpdateDeployment:
306     type: OS::Heat::SoftwareDeployment
307     properties:
308       config: {get_resource: UpdateConfig}
309       server: {get_resource: SwiftStorage}
310       input_values:
311         update_identifier:
312           get_param: UpdateIdentifier
313
314 outputs:
315   ip_address:
316     description: IP address of the server in the ctlplane network
317     value: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
318   hostname:
319     description: Hostname of the server
320     value: {get_attr: [SwiftStorage, name]}
321   hosts_entry:
322     value:
323       str_replace:
324         template: |
325           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
326           EXTERNALIP EXTERNALHOST.DOMAIN EXTERNALHOST
327           INTERNAL_APIIP INTERNAL_APIHOST.DOMAIN INTERNAL_APIHOST
328           STORAGEIP STORAGEHOST.DOMAIN STORAGEHOST
329           STORAGE_MGMTIP STORAGE_MGMTHOST.DOMAIN STORAGE_MGMTHOST
330           TENANTIP TENANTHOST.DOMAIN TENANTHOST
331           MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
332         params:
333           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ObjectStorageHostnameResolveNetwork]}]}
334           DOMAIN: {get_param: CloudDomain}
335           PRIMARYHOST: {get_attr: [SwiftStorage, name]}
336           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
337           EXTERNALHOST:
338             list_join:
339             - '.'
340             - - {get_attr: [SwiftStorage, name]}
341               - external
342           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
343           INTERNAL_APIHOST:
344             list_join:
345             - '.'
346             - - {get_attr: [SwiftStorage, name]}
347               - internalapi
348           STORAGEIP: {get_attr: [StoragePort, ip_address]}
349           STORAGEHOST:
350             list_join:
351             - '.'
352             - - {get_attr: [SwiftStorage, name]}
353               - storage
354           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
355           STORAGE_MGMTHOST:
356             list_join:
357             - '.'
358             - - {get_attr: [SwiftStorage, name]}
359               - storagemgmt
360           TENANTIP: {get_attr: [TenantPort, ip_address]}
361           TENANTHOST:
362             list_join:
363             - '.'
364             - - {get_attr: [SwiftStorage, name]}
365               - tenant
366           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
367           MANAGEMENTHOST:
368             list_join:
369             - '.'
370             - - {get_attr: [SwiftStorage, name]}
371               - management
372   nova_server_resource:
373     description: Heat resource handle for the swift storage server
374     value:
375       {get_resource: SwiftStorage}
376   swift_device:
377     description: Swift device formatted for swift-ring-builder
378     value:
379       str_replace:
380         template: 'r1z1-IP:%PORT%/d1'
381         params:
382           IP:
383             get_attr:
384               - NetIpMap
385               - net_ip_map
386               - str_replace:
387                   template: "NETWORK_uri"
388                   params:
389                     NETWORK: {get_param: [ServiceNetMap, SwiftMgmtNetwork]}
390   external_ip_address:
391     description: IP address of the server in the external network
392     value: {get_attr: [ExternalPort, ip_address]}
393   internal_api_ip_address:
394     description: IP address of the server in the internal_api network
395     value: {get_attr: [InternalApiPort, ip_address]}
396   storage_ip_address:
397     description: IP address of the server in the storage network
398     value: {get_attr: [StoragePort, ip_address]}
399   storage_mgmt_ip_address:
400     description: IP address of the server in the storage_mgmt network
401     value: {get_attr: [StorageMgmtPort, ip_address]}
402   tenant_ip_address:
403     description: IP address of the server in the tenant network
404     value: {get_attr: [TenantPort, ip_address]}
405   management_ip_address:
406     description: IP address of the server in the management network
407     value: {get_attr: [ManagementPort, ip_address]}