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