Merge "Disable the Mon/OSD/Client resources in puppet-ceph-external"
[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   SwiftRawDisks:
105     default: {}
106     description: 'A hash of additional raw devices to use as Swift backend (eg. {sdb: {}})'
107     type: json
108
109 resources:
110
111   SwiftStorage:
112     type: OS::Nova::Server
113     metadata:
114       os-collect-config:
115         command: {get_param: ConfigCommand}
116     properties:
117       image: {get_param: SwiftStorageImage}
118       flavor: {get_param: OvercloudSwiftStorageFlavor}
119       key_name: {get_param: KeyName}
120       networks:
121         - network: ctlplane
122       user_data_format: SOFTWARE_CONFIG
123       user_data: {get_resource: UserData}
124       name:
125         str_replace:
126             template: {get_param: Hostname}
127             params: {get_param: HostnameMap}
128       software_config_transport: {get_param: SoftwareConfigTransport}
129       metadata: {get_param: ServerMetadata}
130       scheduler_hints: {get_param: ObjectStorageSchedulerHints}
131
132   # Combine the NodeAdminUserData and NodeUserData mime archives
133   UserData:
134     type: OS::Heat::MultipartMime
135     properties:
136       parts:
137       - config: {get_resource: NodeAdminUserData}
138         type: multipart
139       - config: {get_resource: NodeUserData}
140         type: multipart
141
142   # Creates the "heat-admin" user if configured via the environment
143   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
144   NodeAdminUserData:
145     type: OS::TripleO::NodeAdminUserData
146
147   # For optional operator additional userdata
148   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
149   NodeUserData:
150     type: OS::TripleO::NodeUserData
151
152   ExternalPort:
153     type: OS::TripleO::SwiftStorage::Ports::ExternalPort
154     properties:
155       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
156       IPPool: {get_param: SwiftStorageIPs}
157       NodeIndex: {get_param: NodeIndex}
158
159   InternalApiPort:
160     type: OS::TripleO::SwiftStorage::Ports::InternalApiPort
161     properties:
162       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
163       IPPool: {get_param: SwiftStorageIPs}
164       NodeIndex: {get_param: NodeIndex}
165
166   StoragePort:
167     type: OS::TripleO::SwiftStorage::Ports::StoragePort
168     properties:
169       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
170       IPPool: {get_param: SwiftStorageIPs}
171       NodeIndex: {get_param: NodeIndex}
172
173   StorageMgmtPort:
174     type: OS::TripleO::SwiftStorage::Ports::StorageMgmtPort
175     properties:
176       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
177       IPPool: {get_param: SwiftStorageIPs}
178       NodeIndex: {get_param: NodeIndex}
179
180   TenantPort:
181     type: OS::TripleO::SwiftStorage::Ports::TenantPort
182     properties:
183       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
184       IPPool: {get_param: SwiftStorageIPs}
185       NodeIndex: {get_param: NodeIndex}
186
187   ManagementPort:
188     type: OS::TripleO::SwiftStorage::Ports::ManagementPort
189     properties:
190       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
191       IPPool: {get_param: SwiftStorageIPs}
192       NodeIndex: {get_param: NodeIndex}
193
194   NetworkConfig:
195     type: OS::TripleO::ObjectStorage::Net::SoftwareConfig
196     properties:
197       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
198       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
199       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
200       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
201       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
202       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
203       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
204
205   NetIpMap:
206     type: OS::TripleO::Network::Ports::NetIpMap
207     properties:
208       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
209       ExternalIp: {get_attr: [ExternalPort, ip_address]}
210       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
211       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
212       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
213       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
214       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
215       StorageIp: {get_attr: [StoragePort, ip_address]}
216       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
217       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
218       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
219       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
220       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
221       TenantIp: {get_attr: [TenantPort, ip_address]}
222       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
223       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
224       ManagementIp: {get_attr: [ManagementPort, ip_address]}
225       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
226       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
227
228   NetworkDeployment:
229     type: OS::TripleO::SoftwareDeployment
230     properties:
231       name: NetworkDeployment
232       config: {get_resource: NetworkConfig}
233       server: {get_resource: SwiftStorage}
234       actions: {get_param: NetworkDeploymentActions}
235
236   SwiftStorageHieraConfig:
237     type: OS::Heat::StructuredConfig
238     properties:
239       group: os-apply-config
240       config:
241         hiera:
242           hierarchy:
243             - '"%{::uuid}"'
244             - heat_config_%{::deploy_config_name}
245             - object_extraconfig
246             - extraconfig
247             - service_names
248             - service_configs
249             - object
250             - swift_devices_and_proxy # provided by SwiftDevicesAndProxyConfig
251             - all_nodes # provided by allNodesConfig
252             - '"%{::osfamily}"'
253           merge_behavior: deeper
254           datafiles:
255             service_names:
256               mapped_data:
257                 service_names: {get_param: ServiceNames}
258             service_configs:
259               mapped_data:
260                 map_replace:
261                   - {get_param: ServiceConfigSettings}
262                   - values: {get_attr: [NetIpMap, net_ip_map]}
263             object_extraconfig:
264               mapped_data: {get_param: ObjectStorageExtraConfig}
265             extraconfig:
266               mapped_data: {get_param: ExtraConfig}
267             object:
268               mapped_data: # data supplied directly to this deployment configuration, etc
269                 swift::swift_hash_path_suffix: { get_input: swift_hash_suffix }
270                 swift::storage::all::storage_local_net_ip: {get_input: swift_management_network}
271                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
272                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
273                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
274
275
276   SwiftStorageHieraDeploy:
277     type: OS::Heat::StructuredDeployment
278     depends_on: NetworkDeployment
279     properties:
280       name: SwiftStorageHieraDeploy
281       server: {get_resource: SwiftStorage}
282       config: {get_resource: SwiftStorageHieraConfig}
283       input_values:
284         local_ip: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
285         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
286         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
287         swift_hash_suffix: {get_param: HashSuffix}
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:
385           list_join:
386             - ','
387             - ['r1z1-IP:%PORT%/d1']
388             - repeat:
389                 template: 'r1z1-IP:%PORT%/DEVICE'
390                 for_each:
391                   DEVICE: {get_param: SwiftRawDisks}
392         params:
393           IP:
394             get_attr:
395               - NetIpMap
396               - net_ip_map
397               - str_replace:
398                   template: "NETWORK_uri"
399                   params:
400                     NETWORK: {get_param: [ServiceNetMap, SwiftMgmtNetwork]}
401   external_ip_address:
402     description: IP address of the server in the external network
403     value: {get_attr: [ExternalPort, ip_address]}
404   internal_api_ip_address:
405     description: IP address of the server in the internal_api network
406     value: {get_attr: [InternalApiPort, ip_address]}
407   storage_ip_address:
408     description: IP address of the server in the storage network
409     value: {get_attr: [StoragePort, ip_address]}
410   storage_mgmt_ip_address:
411     description: IP address of the server in the storage_mgmt network
412     value: {get_attr: [StorageMgmtPort, ip_address]}
413   tenant_ip_address:
414     description: IP address of the server in the tenant network
415     value: {get_attr: [TenantPort, ip_address]}
416   management_ip_address:
417     description: IP address of the server in the management network
418     value: {get_attr: [ManagementPort, ip_address]}