Merge "Change /etc/hosts format and add domain"
[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   RingBuild:
34     default: true
35     description: Whether to manage Swift rings or not
36     type: boolean
37   Replicas:
38     type: number
39     default: 3
40     description: How many replicas to use in the swift rings.
41   SnmpdReadonlyUserName:
42     default: ro_snmp_user
43     description: The user name for SNMPd with readonly rights running on all Overcloud nodes
44     type: string
45   SnmpdReadonlyUserPassword:
46     description: The user password for SNMPd with readonly rights running on all Overcloud nodes
47     type: string
48     hidden: true
49   NtpServer:
50     default: ''
51     description: Comma-separated list of ntp servers
52     type: comma_delimited_list
53   EnablePackageInstall:
54     default: 'false'
55     description: Set to true to enable package installation via Puppet
56     type: boolean
57   UpdateIdentifier:
58     default: ''
59     type: string
60     description: >
61       Setting to a previously unused value during stack-update will trigger
62       package update on all nodes
63   ServiceNetMap:
64     default: {}
65     description: Mapping of service_name -> network name. Typically set
66                  via parameter_defaults in the resource registry.
67     type: json
68   TimeZone:
69     default: 'UTC'
70     description: The timezone to be set on Ceph nodes.
71     type: string
72   Hostname:
73     type: string
74     default: '' # Defaults to Heat created hostname
75   HostnameMap:
76     type: json
77     default: {}
78     description: Optional mapping to override hostnames
79   ExtraConfig:
80     default: {}
81     description: |
82       Additional hiera configuration to inject into the cluster. Note
83       that ObjectStorageExtraConfig takes precedence over ExtraConfig.
84     type: json
85   ObjectStorageExtraConfig:
86     default: {}
87     description: |
88       Role specific additional hiera configuration to inject into the cluster.
89     type: json
90   SwiftStorageIPs:
91     default: {}
92     type: json
93   NetworkDeploymentActions:
94     type: comma_delimited_list
95     description: >
96       Heat action when to apply network configuration changes
97     default: ['CREATE']
98   SoftwareConfigTransport:
99     default: POLL_SERVER_CFN
100     description: |
101       How the server should receive the metadata required for software configuration.
102     type: string
103     constraints:
104     - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
105   CloudDomain:
106     default: ''
107     type: string
108     description: >
109       The DNS domain used for the hosts. This should match the dhcp_domain
110       configured in the Undercloud neutron. Defaults to localdomain.
111   ServerMetadata:
112     default: {}
113     description: >
114       Extra properties or metadata passed to Nova for the created nodes in
115       the overcloud. It's accessible via the Nova metadata API.
116     type: json
117   SchedulerHints:
118     type: json
119     description: Optional scheduler hints to pass to nova
120     default: {}
121   NodeIndex:
122     type: number
123     default: 0
124
125 resources:
126
127   SwiftStorage:
128     type: OS::Nova::Server
129     properties:
130       image: {get_param: Image}
131       flavor: {get_param: Flavor}
132       key_name: {get_param: KeyName}
133       networks:
134         - network: ctlplane
135       user_data_format: SOFTWARE_CONFIG
136       user_data: {get_resource: UserData}
137       name:
138         str_replace:
139             template: {get_param: Hostname}
140             params: {get_param: HostnameMap}
141       software_config_transport: {get_param: SoftwareConfigTransport}
142       metadata: {get_param: ServerMetadata}
143       scheduler_hints: {get_param: SchedulerHints}
144
145   # Combine the NodeAdminUserData and NodeUserData mime archives
146   UserData:
147     type: OS::Heat::MultipartMime
148     properties:
149       parts:
150       - config: {get_resource: NodeAdminUserData}
151         type: multipart
152       - config: {get_resource: NodeUserData}
153         type: multipart
154
155   # Creates the "heat-admin" user if configured via the environment
156   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
157   NodeAdminUserData:
158     type: OS::TripleO::NodeAdminUserData
159
160   # For optional operator additional userdata
161   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
162   NodeUserData:
163     type: OS::TripleO::NodeUserData
164
165   ExternalPort:
166     type: OS::TripleO::SwiftStorage::Ports::ExternalPort
167     properties:
168       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
169       IPPool: {get_param: SwiftStorageIPs}
170       NodeIndex: {get_param: NodeIndex}
171
172   InternalApiPort:
173     type: OS::TripleO::SwiftStorage::Ports::InternalApiPort
174     properties:
175       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
176       IPPool: {get_param: SwiftStorageIPs}
177       NodeIndex: {get_param: NodeIndex}
178
179   StoragePort:
180     type: OS::TripleO::SwiftStorage::Ports::StoragePort
181     properties:
182       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
183       IPPool: {get_param: SwiftStorageIPs}
184       NodeIndex: {get_param: NodeIndex}
185
186   StorageMgmtPort:
187     type: OS::TripleO::SwiftStorage::Ports::StorageMgmtPort
188     properties:
189       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
190       IPPool: {get_param: SwiftStorageIPs}
191       NodeIndex: {get_param: NodeIndex}
192
193   TenantPort:
194     type: OS::TripleO::SwiftStorage::Ports::TenantPort
195     properties:
196       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
197       IPPool: {get_param: SwiftStorageIPs}
198       NodeIndex: {get_param: NodeIndex}
199
200   ManagementPort:
201     type: OS::TripleO::SwiftStorage::Ports::ManagementPort
202     properties:
203       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
204       IPPool: {get_param: SwiftStorageIPs}
205       NodeIndex: {get_param: NodeIndex}
206
207   NetworkConfig:
208     type: OS::TripleO::ObjectStorage::Net::SoftwareConfig
209     properties:
210       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
211       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
212       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
213       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
214       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
215       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
216       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
217
218   NetIpMap:
219     type: OS::TripleO::Network::Ports::NetIpMap
220     properties:
221       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
222       ExternalIp: {get_attr: [ExternalPort, ip_address]}
223       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
224       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
225       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
226       StorageIp: {get_attr: [StoragePort, ip_address]}
227       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
228       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
229       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
230       TenantIp: {get_attr: [TenantPort, ip_address]}
231       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
232       ManagementIp: {get_attr: [ManagementPort, ip_address]}
233       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
234
235   NetworkDeployment:
236     type: OS::TripleO::SoftwareDeployment
237     properties:
238       name: NetworkDeployment
239       config: {get_resource: NetworkConfig}
240       server: {get_resource: SwiftStorage}
241       actions: {get_param: NetworkDeploymentActions}
242
243   SwiftStorageHieraConfig:
244     type: OS::Heat::StructuredConfig
245     properties:
246       group: os-apply-config
247       config:
248         hiera:
249           hierarchy:
250             - '"%{::uuid}"'
251             - heat_config_%{::deploy_config_name}
252             - object_extraconfig
253             - extraconfig
254             - object
255             - swift_devices_and_proxy # provided by SwiftDevicesAndProxyConfig
256             - all_nodes # provided by allNodesConfig
257             - '"%{::osfamily}"'
258             - common
259           datafiles:
260             common:
261               raw_data: {get_file: hieradata/common.yaml}
262             object_extraconfig:
263               mapped_data: {get_param: ObjectStorageExtraConfig}
264             extraconfig:
265               mapped_data: {get_param: ExtraConfig}
266             object:
267               raw_data: {get_file: hieradata/object.yaml}
268               mapped_data: # data supplied directly to this deployment configuration, etc
269                 swift::swift_hash_suffix: { get_input: swift_hash_suffix }
270                 tripleo::ringbuilder::build_ring: { get_input: swift_ring_build }
271                 tripleo::ringbuilder::part_power: { get_input: swift_part_power }
272                 tripleo::ringbuilder::replicas: {get_input: swift_replicas }
273                 swift::storage::all::storage_local_net_ip: {get_input: swift_management_network}
274                 swift_mount_check: {get_input: swift_mount_check }
275                 tripleo::ringbuilder::min_part_hours: { get_input: swift_min_part_hours }
276                 ntp::servers: {get_input: ntp_servers}
277                 timezone::timezone: {get_input: timezone}
278                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
279                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
280                 tripleo::packages::enable_install: {get_input: enable_package_install}
281                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
282
283
284   SwiftStorageHieraDeploy:
285     type: OS::Heat::StructuredDeployment
286     depends_on: NetworkDeployment
287     properties:
288       name: SwiftStorageHieraDeploy
289       server: {get_resource: SwiftStorage}
290       config: {get_resource: SwiftStorageHieraConfig}
291       input_values:
292         local_ip: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
293         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
294         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
295         swift_hash_suffix: {get_param: HashSuffix}
296         swift_mount_check: {get_param: MountCheck}
297         swift_min_part_hours: {get_param: MinPartHours}
298         swift_ring_build: {get_param: RingBuild}
299         swift_part_power: {get_param: PartPower}
300         swift_replicas: { get_param: Replicas}
301         ntp_servers: {get_param: NtpServer}
302         timezone: {get_param: TimeZone}
303         enable_package_install: {get_param: EnablePackageInstall}
304         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
305         swift_management_network: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
306
307   # Resource for site-specific injection of root certificate
308   NodeTLSCAData:
309     depends_on: SwiftStorageHieraDeploy
310     type: OS::TripleO::NodeTLSCAData
311     properties:
312       server: {get_resource: SwiftStorage}
313
314   # Hook for site-specific additional pre-deployment config,
315   # applying to all nodes, e.g node registration/unregistration
316   NodeExtraConfig:
317     depends_on: NodeTLSCAData
318     type: OS::TripleO::NodeExtraConfig
319     properties:
320         server: {get_resource: SwiftStorage}
321
322   UpdateConfig:
323     type: OS::TripleO::Tasks::PackageUpdate
324
325   UpdateDeployment:
326     type: OS::Heat::SoftwareDeployment
327     properties:
328       config: {get_resource: UpdateConfig}
329       server: {get_resource: SwiftStorage}
330       input_values:
331         update_identifier:
332           get_param: UpdateIdentifier
333
334 outputs:
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]}
415   config_identifier:
416     description: identifier which changes if the node configuration may need re-applying
417     value:
418       list_join:
419         - ','
420         - - {get_attr: [SwiftStorageHieraDeploy, deploy_stdout]}
421           - {get_attr: [NodeTLSCAData, deploy_stdout]}
422           - {get_param: UpdateIdentifier}