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