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