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