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