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