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