Merge "Composable firewall rules"
[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   ServiceNames:
100     type: comma_delimited_list
101     default: []
102   ConfigCommand:
103     type: string
104     description: Command which will be run whenever configuration data changes
105     default: os-refresh-config --timeout 14400
106
107 resources:
108
109   SwiftStorage:
110     type: OS::Nova::Server
111     metadata:
112       os-collect-config:
113         command: {get_param: ConfigCommand}
114     properties:
115       image: {get_param: Image}
116       flavor: {get_param: Flavor}
117       key_name: {get_param: KeyName}
118       networks:
119         - network: ctlplane
120       user_data_format: SOFTWARE_CONFIG
121       user_data: {get_resource: UserData}
122       name:
123         str_replace:
124             template: {get_param: Hostname}
125             params: {get_param: HostnameMap}
126       software_config_transport: {get_param: SoftwareConfigTransport}
127       metadata: {get_param: ServerMetadata}
128       scheduler_hints: {get_param: SchedulerHints}
129
130   # Combine the NodeAdminUserData and NodeUserData mime archives
131   UserData:
132     type: OS::Heat::MultipartMime
133     properties:
134       parts:
135       - config: {get_resource: NodeAdminUserData}
136         type: multipart
137       - config: {get_resource: NodeUserData}
138         type: multipart
139
140   # Creates the "heat-admin" user if configured via the environment
141   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
142   NodeAdminUserData:
143     type: OS::TripleO::NodeAdminUserData
144
145   # For optional operator additional userdata
146   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
147   NodeUserData:
148     type: OS::TripleO::NodeUserData
149
150   ExternalPort:
151     type: OS::TripleO::SwiftStorage::Ports::ExternalPort
152     properties:
153       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
154       IPPool: {get_param: SwiftStorageIPs}
155       NodeIndex: {get_param: NodeIndex}
156
157   InternalApiPort:
158     type: OS::TripleO::SwiftStorage::Ports::InternalApiPort
159     properties:
160       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
161       IPPool: {get_param: SwiftStorageIPs}
162       NodeIndex: {get_param: NodeIndex}
163
164   StoragePort:
165     type: OS::TripleO::SwiftStorage::Ports::StoragePort
166     properties:
167       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
168       IPPool: {get_param: SwiftStorageIPs}
169       NodeIndex: {get_param: NodeIndex}
170
171   StorageMgmtPort:
172     type: OS::TripleO::SwiftStorage::Ports::StorageMgmtPort
173     properties:
174       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
175       IPPool: {get_param: SwiftStorageIPs}
176       NodeIndex: {get_param: NodeIndex}
177
178   TenantPort:
179     type: OS::TripleO::SwiftStorage::Ports::TenantPort
180     properties:
181       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
182       IPPool: {get_param: SwiftStorageIPs}
183       NodeIndex: {get_param: NodeIndex}
184
185   ManagementPort:
186     type: OS::TripleO::SwiftStorage::Ports::ManagementPort
187     properties:
188       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
189       IPPool: {get_param: SwiftStorageIPs}
190       NodeIndex: {get_param: NodeIndex}
191
192   NetworkConfig:
193     type: OS::TripleO::ObjectStorage::Net::SoftwareConfig
194     properties:
195       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
196       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
197       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
198       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
199       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
200       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
201       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
202
203   NetIpMap:
204     type: OS::TripleO::Network::Ports::NetIpMap
205     properties:
206       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
207       ExternalIp: {get_attr: [ExternalPort, ip_address]}
208       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
209       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
210       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
211       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
212       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
213       StorageIp: {get_attr: [StoragePort, ip_address]}
214       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
215       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
216       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
217       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
218       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
219       TenantIp: {get_attr: [TenantPort, ip_address]}
220       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
221       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
222       ManagementIp: {get_attr: [ManagementPort, ip_address]}
223       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
224       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
225
226   NetworkDeployment:
227     type: OS::TripleO::SoftwareDeployment
228     properties:
229       name: NetworkDeployment
230       config: {get_resource: NetworkConfig}
231       server: {get_resource: SwiftStorage}
232       actions: {get_param: NetworkDeploymentActions}
233
234   SwiftStorageHieraConfig:
235     type: OS::Heat::StructuredConfig
236     properties:
237       group: os-apply-config
238       config:
239         hiera:
240           hierarchy:
241             - '"%{::uuid}"'
242             - heat_config_%{::deploy_config_name}
243             - object_extraconfig
244             - extraconfig
245             - service_names
246             - service_configs
247             - object
248             - swift_devices_and_proxy # provided by SwiftDevicesAndProxyConfig
249             - all_nodes # provided by allNodesConfig
250             - '"%{::osfamily}"'
251             - common
252             - network
253           merge_behavior: deeper
254           datafiles:
255             service_names:
256               mapped_data:
257                 service_names: {get_param: ServiceNames}
258             service_configs:
259               mapped_data: {get_param: ServiceConfigSettings}
260             common:
261               raw_data: {get_file: hieradata/common.yaml}
262             network:
263               mapped_data:
264                 net_ip_map: {get_attr: [NetIpMap, net_ip_map]}
265                 net_ip_subnet_map: {get_attr: [NetIpMap, net_ip_subnet_map]}
266                 net_ip_uri_map: {get_attr: [NetIpMap, net_ip_uri_map]}
267             object_extraconfig:
268               mapped_data: {get_param: ObjectStorageExtraConfig}
269             extraconfig:
270               mapped_data: {get_param: ExtraConfig}
271             object:
272               raw_data: {get_file: hieradata/object.yaml}
273               mapped_data: # data supplied directly to this deployment configuration, etc
274                 swift::swift_hash_path_suffix: { get_input: swift_hash_suffix }
275                 swift::storage::all::storage_local_net_ip: {get_input: swift_management_network}
276                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
277                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
278                 tripleo::packages::enable_install: {get_input: enable_package_install}
279                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
280
281
282   SwiftStorageHieraDeploy:
283     type: OS::Heat::StructuredDeployment
284     depends_on: NetworkDeployment
285     properties:
286       name: SwiftStorageHieraDeploy
287       server: {get_resource: SwiftStorage}
288       config: {get_resource: SwiftStorageHieraConfig}
289       input_values:
290         local_ip: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
291         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
292         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
293         swift_hash_suffix: {get_param: HashSuffix}
294         enable_package_install: {get_param: EnablePackageInstall}
295         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
296         swift_management_network: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
297
298   # Resource for site-specific injection of root certificate
299   NodeTLSCAData:
300     depends_on: SwiftStorageHieraDeploy
301     type: OS::TripleO::NodeTLSCAData
302     properties:
303       server: {get_resource: SwiftStorage}
304
305   # Hook for site-specific additional pre-deployment config,
306   # applying to all nodes, e.g node registration/unregistration
307   NodeExtraConfig:
308     depends_on: NodeTLSCAData
309     type: OS::TripleO::NodeExtraConfig
310     properties:
311         server: {get_resource: SwiftStorage}
312
313   UpdateConfig:
314     type: OS::TripleO::Tasks::PackageUpdate
315
316   UpdateDeployment:
317     type: OS::Heat::SoftwareDeployment
318     properties:
319       config: {get_resource: UpdateConfig}
320       server: {get_resource: SwiftStorage}
321       input_values:
322         update_identifier:
323           get_param: UpdateIdentifier
324
325 outputs:
326   ip_address:
327     description: IP address of the server in the ctlplane network
328     value: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
329   hostname:
330     description: Hostname of the server
331     value: {get_attr: [SwiftStorage, name]}
332   hosts_entry:
333     value:
334       str_replace:
335         template: |
336           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
337           EXTERNALIP EXTERNALHOST.DOMAIN EXTERNALHOST
338           INTERNAL_APIIP INTERNAL_APIHOST.DOMAIN INTERNAL_APIHOST
339           STORAGEIP STORAGEHOST.DOMAIN STORAGEHOST
340           STORAGE_MGMTIP STORAGE_MGMTHOST.DOMAIN STORAGE_MGMTHOST
341           TENANTIP TENANTHOST.DOMAIN TENANTHOST
342           MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
343         params:
344           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ObjectStorageHostnameResolveNetwork]}]}
345           DOMAIN: {get_param: CloudDomain}
346           PRIMARYHOST: {get_attr: [SwiftStorage, name]}
347           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
348           EXTERNALHOST:
349             list_join:
350             - '.'
351             - - {get_attr: [SwiftStorage, name]}
352               - external
353           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
354           INTERNAL_APIHOST:
355             list_join:
356             - '.'
357             - - {get_attr: [SwiftStorage, name]}
358               - internalapi
359           STORAGEIP: {get_attr: [StoragePort, ip_address]}
360           STORAGEHOST:
361             list_join:
362             - '.'
363             - - {get_attr: [SwiftStorage, name]}
364               - storage
365           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
366           STORAGE_MGMTHOST:
367             list_join:
368             - '.'
369             - - {get_attr: [SwiftStorage, name]}
370               - storagemgmt
371           TENANTIP: {get_attr: [TenantPort, ip_address]}
372           TENANTHOST:
373             list_join:
374             - '.'
375             - - {get_attr: [SwiftStorage, name]}
376               - tenant
377           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
378           MANAGEMENTHOST:
379             list_join:
380             - '.'
381             - - {get_attr: [SwiftStorage, name]}
382               - management
383   nova_server_resource:
384     description: Heat resource handle for the swift storage server
385     value:
386       {get_resource: SwiftStorage}
387   swift_device:
388     description: Swift device formatted for swift-ring-builder
389     value:
390       str_replace:
391         template: 'r1z1-IP:%PORT%/d1'
392         params:
393           IP: {get_attr: [NetIpMap, net_ip_uri_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
394   external_ip_address:
395     description: IP address of the server in the external network
396     value: {get_attr: [ExternalPort, ip_address]}
397   internal_api_ip_address:
398     description: IP address of the server in the internal_api network
399     value: {get_attr: [InternalApiPort, ip_address]}
400   storage_ip_address:
401     description: IP address of the server in the storage network
402     value: {get_attr: [StoragePort, ip_address]}
403   storage_mgmt_ip_address:
404     description: IP address of the server in the storage_mgmt network
405     value: {get_attr: [StorageMgmtPort, ip_address]}
406   tenant_ip_address:
407     description: IP address of the server in the tenant network
408     value: {get_attr: [TenantPort, ip_address]}
409   management_ip_address:
410     description: IP address of the server in the management network
411     value: {get_attr: [ManagementPort, ip_address]}