Merge "Composable neutron nuage plugin"
[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   MountCheck:
22     default: 'false'
23     description: Value of mount_check in Swift account/container/object -server.conf
24     type: boolean
25   MinPartHours:
26     type: number
27     default: 1
28     description: The minimum time (in hours) before a partition in a ring can be moved following a rebalance.
29   PartPower:
30     default: 10
31     description: Partition Power to use when building Swift rings
32     type: number
33   RingBuild:
34     default: true
35     description: Whether to manage Swift rings or not
36     type: boolean
37   Replicas:
38     type: number
39     default: 3
40     description: How many replicas to use in the swift rings.
41   SnmpdReadonlyUserName:
42     default: ro_snmp_user
43     description: The user name for SNMPd with readonly rights running on all Overcloud nodes
44     type: string
45   SnmpdReadonlyUserPassword:
46     description: The user password for SNMPd with readonly rights running on all Overcloud nodes
47     type: string
48     hidden: true
49   NtpServer:
50     default: ''
51     description: Comma-separated list of ntp servers
52     type: comma_delimited_list
53   EnablePackageInstall:
54     default: 'false'
55     description: Set to true to enable package installation via Puppet
56     type: boolean
57   UpdateIdentifier:
58     default: ''
59     type: string
60     description: >
61       Setting to a previously unused value during stack-update will trigger
62       package update on all nodes
63   ServiceNetMap:
64     default: {}
65     description: Mapping of service_name -> network name. Typically set
66                  via parameter_defaults in the resource registry.
67     type: json
68   TimeZone:
69     default: 'UTC'
70     description: The timezone to be set on Ceph nodes.
71     type: string
72   Hostname:
73     type: string
74     default: '' # Defaults to Heat created hostname
75   HostnameMap:
76     type: json
77     default: {}
78     description: Optional mapping to override hostnames
79   ExtraConfig:
80     default: {}
81     description: |
82       Additional hiera configuration to inject into the cluster. Note
83       that ObjectStorageExtraConfig takes precedence over ExtraConfig.
84     type: json
85   ObjectStorageExtraConfig:
86     default: {}
87     description: |
88       Role specific additional hiera configuration to inject into the cluster.
89     type: json
90   SwiftStorageIPs:
91     default: {}
92     type: json
93   NetworkDeploymentActions:
94     type: comma_delimited_list
95     description: >
96       Heat action when to apply network configuration changes
97     default: ['CREATE']
98   SoftwareConfigTransport:
99     default: POLL_SERVER_CFN
100     description: |
101       How the server should receive the metadata required for software configuration.
102     type: string
103     constraints:
104     - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
105   CloudDomain:
106     default: ''
107     type: string
108     description: >
109       The DNS domain used for the hosts. This should match the dhcp_domain
110       configured in the Undercloud neutron. Defaults to localdomain.
111   ServerMetadata:
112     default: {}
113     description: >
114       Extra properties or metadata passed to Nova for the created nodes in
115       the overcloud. It's accessible via the Nova metadata API.
116     type: json
117   SchedulerHints:
118     type: json
119     description: Optional scheduler hints to pass to nova
120     default: {}
121   NodeIndex:
122     type: number
123     default: 0
124   ServiceConfigSettings:
125     type: json
126     default: {}
127
128 resources:
129
130   SwiftStorage:
131     type: OS::Nova::Server
132     properties:
133       image: {get_param: Image}
134       flavor: {get_param: Flavor}
135       key_name: {get_param: KeyName}
136       networks:
137         - network: ctlplane
138       user_data_format: SOFTWARE_CONFIG
139       user_data: {get_resource: UserData}
140       name:
141         str_replace:
142             template: {get_param: Hostname}
143             params: {get_param: HostnameMap}
144       software_config_transport: {get_param: SoftwareConfigTransport}
145       metadata: {get_param: ServerMetadata}
146       scheduler_hints: {get_param: SchedulerHints}
147
148   # Combine the NodeAdminUserData and NodeUserData mime archives
149   UserData:
150     type: OS::Heat::MultipartMime
151     properties:
152       parts:
153       - config: {get_resource: NodeAdminUserData}
154         type: multipart
155       - config: {get_resource: NodeUserData}
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   ExternalPort:
169     type: OS::TripleO::SwiftStorage::Ports::ExternalPort
170     properties:
171       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
172       IPPool: {get_param: SwiftStorageIPs}
173       NodeIndex: {get_param: NodeIndex}
174
175   InternalApiPort:
176     type: OS::TripleO::SwiftStorage::Ports::InternalApiPort
177     properties:
178       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
179       IPPool: {get_param: SwiftStorageIPs}
180       NodeIndex: {get_param: NodeIndex}
181
182   StoragePort:
183     type: OS::TripleO::SwiftStorage::Ports::StoragePort
184     properties:
185       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
186       IPPool: {get_param: SwiftStorageIPs}
187       NodeIndex: {get_param: NodeIndex}
188
189   StorageMgmtPort:
190     type: OS::TripleO::SwiftStorage::Ports::StorageMgmtPort
191     properties:
192       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
193       IPPool: {get_param: SwiftStorageIPs}
194       NodeIndex: {get_param: NodeIndex}
195
196   TenantPort:
197     type: OS::TripleO::SwiftStorage::Ports::TenantPort
198     properties:
199       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
200       IPPool: {get_param: SwiftStorageIPs}
201       NodeIndex: {get_param: NodeIndex}
202
203   ManagementPort:
204     type: OS::TripleO::SwiftStorage::Ports::ManagementPort
205     properties:
206       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
207       IPPool: {get_param: SwiftStorageIPs}
208       NodeIndex: {get_param: NodeIndex}
209
210   NetworkConfig:
211     type: OS::TripleO::ObjectStorage::Net::SoftwareConfig
212     properties:
213       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
214       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
215       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
216       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
217       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
218       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
219       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
220
221   NetIpMap:
222     type: OS::TripleO::Network::Ports::NetIpMap
223     properties:
224       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
225       ExternalIp: {get_attr: [ExternalPort, ip_address]}
226       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
227       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
228       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
229       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
230       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
231       StorageIp: {get_attr: [StoragePort, ip_address]}
232       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
233       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
234       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
235       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
236       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
237       TenantIp: {get_attr: [TenantPort, ip_address]}
238       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
239       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
240       ManagementIp: {get_attr: [ManagementPort, ip_address]}
241       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
242       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
243
244   NetworkDeployment:
245     type: OS::TripleO::SoftwareDeployment
246     properties:
247       name: NetworkDeployment
248       config: {get_resource: NetworkConfig}
249       server: {get_resource: SwiftStorage}
250       actions: {get_param: NetworkDeploymentActions}
251
252   SwiftStorageHieraConfig:
253     type: OS::Heat::StructuredConfig
254     properties:
255       group: os-apply-config
256       config:
257         hiera:
258           hierarchy:
259             - '"%{::uuid}"'
260             - heat_config_%{::deploy_config_name}
261             - object_extraconfig
262             - extraconfig
263             - service_configs
264             - object
265             - swift_devices_and_proxy # provided by SwiftDevicesAndProxyConfig
266             - all_nodes # provided by allNodesConfig
267             - '"%{::osfamily}"'
268             - common
269             - network
270           merge_behavior: deeper
271           datafiles:
272             service_configs:
273               mapped_data: {get_param: ServiceConfigSettings}
274             common:
275               raw_data: {get_file: hieradata/common.yaml}
276             network:
277               mapped_data:
278                 net_ip_map: {get_attr: [NetIpMap, net_ip_map]}
279                 net_ip_subnet_map: {get_attr: [NetIpMap, net_ip_subnet_map]}
280                 net_ip_uri_map: {get_attr: [NetIpMap, net_ip_uri_map]}
281             object_extraconfig:
282               mapped_data: {get_param: ObjectStorageExtraConfig}
283             extraconfig:
284               mapped_data: {get_param: ExtraConfig}
285             object:
286               raw_data: {get_file: hieradata/object.yaml}
287               mapped_data: # data supplied directly to this deployment configuration, etc
288                 swift::swift_hash_path_suffix: { get_input: swift_hash_suffix }
289                 tripleo::ringbuilder::build_ring: { get_input: swift_ring_build }
290                 tripleo::ringbuilder::part_power: { get_input: swift_part_power }
291                 tripleo::ringbuilder::replicas: {get_input: swift_replicas }
292                 swift::storage::all::storage_local_net_ip: {get_input: swift_management_network}
293                 swift_mount_check: {get_input: swift_mount_check }
294                 tripleo::ringbuilder::min_part_hours: { get_input: swift_min_part_hours }
295                 ntp::servers: {get_input: ntp_servers}
296                 timezone::timezone: {get_input: timezone}
297                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
298                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
299                 tripleo::packages::enable_install: {get_input: enable_package_install}
300                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
301
302
303   SwiftStorageHieraDeploy:
304     type: OS::Heat::StructuredDeployment
305     depends_on: NetworkDeployment
306     properties:
307       name: SwiftStorageHieraDeploy
308       server: {get_resource: SwiftStorage}
309       config: {get_resource: SwiftStorageHieraConfig}
310       input_values:
311         local_ip: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
312         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
313         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
314         swift_hash_suffix: {get_param: HashSuffix}
315         swift_mount_check: {get_param: MountCheck}
316         swift_min_part_hours: {get_param: MinPartHours}
317         swift_ring_build: {get_param: RingBuild}
318         swift_part_power: {get_param: PartPower}
319         swift_replicas: { get_param: Replicas}
320         ntp_servers: {get_param: NtpServer}
321         timezone: {get_param: TimeZone}
322         enable_package_install: {get_param: EnablePackageInstall}
323         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
324         swift_management_network: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
325
326   # Resource for site-specific injection of root certificate
327   NodeTLSCAData:
328     depends_on: SwiftStorageHieraDeploy
329     type: OS::TripleO::NodeTLSCAData
330     properties:
331       server: {get_resource: SwiftStorage}
332
333   # Hook for site-specific additional pre-deployment config,
334   # applying to all nodes, e.g node registration/unregistration
335   NodeExtraConfig:
336     depends_on: NodeTLSCAData
337     type: OS::TripleO::NodeExtraConfig
338     properties:
339         server: {get_resource: SwiftStorage}
340
341   UpdateConfig:
342     type: OS::TripleO::Tasks::PackageUpdate
343
344   UpdateDeployment:
345     type: OS::Heat::SoftwareDeployment
346     properties:
347       config: {get_resource: UpdateConfig}
348       server: {get_resource: SwiftStorage}
349       input_values:
350         update_identifier:
351           get_param: UpdateIdentifier
352
353 outputs:
354   hosts_entry:
355     value:
356       str_replace:
357         template: |
358           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
359           EXTERNALIP EXTERNALHOST.DOMAIN EXTERNALHOST
360           INTERNAL_APIIP INTERNAL_APIHOST.DOMAIN INTERNAL_APIHOST
361           STORAGEIP STORAGEHOST.DOMAIN STORAGEHOST
362           STORAGE_MGMTIP STORAGE_MGMTHOST.DOMAIN STORAGE_MGMTHOST
363           TENANTIP TENANTHOST.DOMAIN TENANTHOST
364           MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
365         params:
366           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ObjectStorageHostnameResolveNetwork]}]}
367           DOMAIN: {get_param: CloudDomain}
368           PRIMARYHOST: {get_attr: [SwiftStorage, name]}
369           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
370           EXTERNALHOST:
371             list_join:
372             - '.'
373             - - {get_attr: [SwiftStorage, name]}
374               - external
375           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
376           INTERNAL_APIHOST:
377             list_join:
378             - '.'
379             - - {get_attr: [SwiftStorage, name]}
380               - internalapi
381           STORAGEIP: {get_attr: [StoragePort, ip_address]}
382           STORAGEHOST:
383             list_join:
384             - '.'
385             - - {get_attr: [SwiftStorage, name]}
386               - storage
387           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
388           STORAGE_MGMTHOST:
389             list_join:
390             - '.'
391             - - {get_attr: [SwiftStorage, name]}
392               - storagemgmt
393           TENANTIP: {get_attr: [TenantPort, ip_address]}
394           TENANTHOST:
395             list_join:
396             - '.'
397             - - {get_attr: [SwiftStorage, name]}
398               - tenant
399           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
400           MANAGEMENTHOST:
401             list_join:
402             - '.'
403             - - {get_attr: [SwiftStorage, name]}
404               - management
405   nova_server_resource:
406     description: Heat resource handle for the swift storage server
407     value:
408       {get_resource: SwiftStorage}
409   swift_device:
410     description: Swift device formatted for swift-ring-builder
411     value:
412       str_replace:
413         template: 'r1z1-IP:%PORT%/d1'
414         params:
415           IP: {get_attr: [NetIpMap, net_ip_uri_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
416   external_ip_address:
417     description: IP address of the server in the external network
418     value: {get_attr: [ExternalPort, ip_address]}
419   internal_api_ip_address:
420     description: IP address of the server in the internal_api network
421     value: {get_attr: [InternalApiPort, ip_address]}
422   storage_ip_address:
423     description: IP address of the server in the storage network
424     value: {get_attr: [StoragePort, ip_address]}
425   storage_mgmt_ip_address:
426     description: IP address of the server in the storage_mgmt network
427     value: {get_attr: [StorageMgmtPort, ip_address]}
428   tenant_ip_address:
429     description: IP address of the server in the tenant network
430     value: {get_attr: [TenantPort, ip_address]}
431   management_ip_address:
432     description: IP address of the server in the management network
433     value: {get_attr: [ManagementPort, ip_address]}
434   config_identifier:
435     description: identifier which changes if the node configuration may need re-applying
436     value:
437       list_join:
438         - ','
439         - - {get_attr: [SwiftStorageHieraDeploy, deploy_stdout]}
440           - {get_attr: [NodeTLSCAData, deploy_stdout]}
441           - {get_param: UpdateIdentifier}