Merge "Keystone domain for Heat"
[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   Image:
5     default: overcloud-cinder-volume
6     type: string
7   CinderEnableIscsiBackend:
8     default: true
9     description: Whether to enable or not the Iscsi backend for Cinder
10     type: boolean
11   CinderISCSIHelper:
12     default: lioadm
13     description: The iSCSI helper to use with cinder.
14     type: string
15   CinderLVMLoopDeviceSize:
16     default: 10280
17     description: The size of the loopback file used by the cinder LVM driver.
18     type: number
19   CinderPassword:
20     description: The password for the cinder service and db account, used by cinder-api.
21     type: string
22     hidden: true
23   Debug:
24     default: ''
25     description: Set to True to enable debugging on all services.
26     type: string
27   VirtualIP: # deprecated. Use per service VIPs instead.
28     default: ''
29     type: string
30   ExtraConfig:
31     default: {}
32     description: |
33       Additional hiera configuration to inject into the cluster. Note
34       that BlockStorageExtraConfig takes precedence over ExtraConfig.
35     type: json
36   BlockStorageExtraConfig:
37     default: {}
38     description: |
39       Role specific additional hiera configuration to inject into the cluster.
40     type: json
41   BlockStorageIPs:
42     default: {}
43     type: json
44   Flavor:
45     description: Flavor for block storage nodes to request when deploying.
46     type: string
47     constraints:
48       - custom_constraint: nova.flavor
49   KeyName:
50     default: default
51     description: Name of an existing Nova key pair to enable SSH access to the instances
52     type: string
53   RabbitPassword:
54     default: 'guest'
55     type: string
56     hidden: true
57   RabbitUserName:
58     default: 'guest'
59     type: string
60   RabbitClientUseSSL:
61     default: false
62     description: >
63         Rabbit client subscriber parameter to specify
64         an SSL connection to the RabbitMQ host.
65     type: string
66   RabbitClientPort:
67     default: 5672
68     description: Set rabbit subscriber port, change this if using SSL
69     type: number
70   SnmpdReadonlyUserName:
71     default: ro_snmp_user
72     description: The user name for SNMPd with readonly rights running on all Overcloud nodes
73     type: string
74   SnmpdReadonlyUserPassword:
75     description: The user password for SNMPd with readonly rights running on all Overcloud nodes
76     type: string
77     hidden: true
78   NtpServer:
79     default: ''
80     description: Comma-separated list of ntp servers
81     type: comma_delimited_list
82   EnablePackageInstall:
83     default: 'false'
84     description: Set to true to enable package installation via Puppet
85     type: boolean
86   UpdateIdentifier:
87     default: ''
88     type: string
89     description: >
90       Setting to a previously unused value during stack-update will trigger
91       package update on all nodes
92   Hostname:
93     type: string
94     default: '' # Defaults to Heat created hostname
95   HostnameMap:
96     type: json
97     default: {}
98     description: Optional mapping to override hostnames
99   ServiceNetMap:
100     default: {}
101     description: Mapping of service_name -> network name. Typically set
102                  via parameter_defaults in the resource registry.
103     type: json
104   EndpointMap:
105     default: {}
106     description: Mapping of service endpoint -> protocol. Typically set
107                  via parameter_defaults in the resource registry.
108     type: json
109   TimeZone:
110     default: 'UTC'
111     description: The timezone to be set on Cinder nodes.
112     type: string
113   GlanceApiVirtualIP:
114     type: string
115     default: ''
116   MysqlVirtualIPUri:
117     type: string
118     default: ''
119   NetworkDeploymentActions:
120     type: comma_delimited_list
121     description: >
122       Heat action when to apply network configuration changes
123     default: ['CREATE']
124   SoftwareConfigTransport:
125     default: POLL_SERVER_CFN
126     description: |
127       How the server should receive the metadata required for software configuration.
128     type: string
129     constraints:
130     - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
131   CloudDomain:
132     default: ''
133     type: string
134     description: >
135       The DNS domain used for the hosts. This should match the dhcp_domain
136       configured in the Undercloud neutron. Defaults to localdomain.
137   ServerMetadata:
138     default: {}
139     description: >
140       Extra properties or metadata passed to Nova for the created nodes in
141       the overcloud. It's accessible via the Nova metadata API.
142     type: json
143   SchedulerHints:
144     type: json
145     description: Optional scheduler hints to pass to nova
146     default: {}
147   NodeIndex:
148     type: number
149     default: 0
150
151
152 resources:
153   BlockStorage:
154     type: OS::Nova::Server
155     properties:
156       image:
157         {get_param: Image}
158       flavor: {get_param: Flavor}
159       key_name: {get_param: KeyName}
160       networks:
161         - network: ctlplane
162       user_data_format: SOFTWARE_CONFIG
163       user_data: {get_resource: UserData}
164       name:
165         str_replace:
166             template: {get_param: Hostname}
167             params: {get_param: HostnameMap}
168       software_config_transport: {get_param: SoftwareConfigTransport}
169       metadata: {get_param: ServerMetadata}
170       scheduler_hints: {get_param: SchedulerHints}
171
172   # Combine the NodeAdminUserData and NodeUserData mime archives
173   UserData:
174     type: OS::Heat::MultipartMime
175     properties:
176       parts:
177       - config: {get_resource: NodeAdminUserData}
178         type: multipart
179       - config: {get_resource: NodeUserData}
180         type: multipart
181
182   # Creates the "heat-admin" user if configured via the environment
183   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
184   NodeAdminUserData:
185     type: OS::TripleO::NodeAdminUserData
186
187   # For optional operator additional userdata
188   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
189   NodeUserData:
190     type: OS::TripleO::NodeUserData
191
192   ExternalPort:
193     type: OS::TripleO::BlockStorage::Ports::ExternalPort
194     properties:
195       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
196       IPPool: {get_param: BlockStorageIPs}
197       NodeIndex: {get_param: NodeIndex}
198
199   InternalApiPort:
200     type: OS::TripleO::BlockStorage::Ports::InternalApiPort
201     properties:
202       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
203       IPPool: {get_param: BlockStorageIPs}
204       NodeIndex: {get_param: NodeIndex}
205
206   StoragePort:
207     type: OS::TripleO::BlockStorage::Ports::StoragePort
208     properties:
209       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
210       IPPool: {get_param: BlockStorageIPs}
211       NodeIndex: {get_param: NodeIndex}
212
213   StorageMgmtPort:
214     type: OS::TripleO::BlockStorage::Ports::StorageMgmtPort
215     properties:
216       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
217       IPPool: {get_param: BlockStorageIPs}
218       NodeIndex: {get_param: NodeIndex}
219
220   TenantPort:
221     type: OS::TripleO::BlockStorage::Ports::TenantPort
222     properties:
223       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
224       IPPool: {get_param: BlockStorageIPs}
225       NodeIndex: {get_param: NodeIndex}
226
227   ManagementPort:
228     type: OS::TripleO::BlockStorage::Ports::ManagementPort
229     properties:
230       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
231       IPPool: {get_param: BlockStorageIPs}
232       NodeIndex: {get_param: NodeIndex}
233
234   NetworkConfig:
235     type: OS::TripleO::BlockStorage::Net::SoftwareConfig
236     properties:
237       ControlPlaneIp: {get_attr: [BlockStorage, networks, ctlplane, 0]}
238       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
239       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
240       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
241       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
242       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
243       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
244
245   NetIpMap:
246     type: OS::TripleO::Network::Ports::NetIpMap
247     properties:
248       ControlPlaneIp: {get_attr: [BlockStorage, networks, ctlplane, 0]}
249       ExternalIp: {get_attr: [ExternalPort, ip_address]}
250       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
251       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
252       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
253       StorageIp: {get_attr: [StoragePort, ip_address]}
254       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
255       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
256       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
257       TenantIp: {get_attr: [TenantPort, ip_address]}
258       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
259       ManagementIp: {get_attr: [ManagementPort, ip_address]}
260       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
261
262   NetworkDeployment:
263     type: OS::TripleO::SoftwareDeployment
264     properties:
265       name: NetworkDeployment
266       config: {get_resource: NetworkConfig}
267       server: {get_resource: BlockStorage}
268       actions: {get_param: NetworkDeploymentActions}
269
270   BlockStorageDeployment:
271     type: OS::Heat::StructuredDeployment
272     depends_on: NetworkDeployment
273     properties:
274       name: BlockStorageDeployment
275       server: {get_resource: BlockStorage}
276       config: {get_resource: BlockStorageConfig}
277       input_values:
278         debug: {get_param: Debug}
279         cinder_dsn: {list_join: ['', ['mysql+pymysql://cinder:', {get_param: CinderPassword}, '@', {get_param: MysqlVirtualIPUri} , '/cinder']]}
280         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
281         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
282         cinder_lvm_loop_device_size:
283           str_replace:
284             template: sizeM
285             params:
286               size: {get_param: CinderLVMLoopDeviceSize}
287         cinder_enable_iscsi_backend: {get_param: CinderEnableIscsiBackend}
288         cinder_iscsi_helper: {get_param: CinderISCSIHelper}
289         cinder_iscsi_ip_address: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, CinderIscsiNetwork]}]}
290         glance_api_servers: {get_param: [EndpointMap, GlanceInternal, uri]}
291         rabbit_username: {get_param: RabbitUserName}
292         rabbit_password: {get_param: RabbitPassword}
293         rabbit_client_use_ssl: {get_param: RabbitClientUseSSL}
294         rabbit_client_port: {get_param: RabbitClientPort}
295         ntp_servers: {get_param: NtpServer}
296         timezone: {get_param: TimeZone}
297         enable_package_install: {get_param: EnablePackageInstall}
298         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
299
300   # Map heat metadata into hiera datafiles
301   BlockStorageConfig:
302     type: OS::Heat::StructuredConfig
303     properties:
304       group: os-apply-config
305       config:
306         hiera:
307           hierarchy:
308             - '"%{::uuid}"'
309             - heat_config_%{::deploy_config_name}
310             - volume_extraconfig
311             - extraconfig
312             - volume
313             - all_nodes # provided by allNodesConfig
314             - '"%{::osfamily}"'
315             - common
316           datafiles:
317             common:
318               raw_data: {get_file: hieradata/common.yaml}
319             volume_extraconfig:
320               mapped_data: {get_param: BlockStorageExtraConfig}
321             extraconfig:
322               mapped_data: {get_param: ExtraConfig}
323             volume:
324               raw_data: {get_file: hieradata/volume.yaml}
325               mapped_data:
326                 # Cinder
327                 cinder::debug: {get_input: debug}
328                 cinder::setup_test_volume::size: {get_input: cinder_lvm_loop_device_size}
329                 cinder_iscsi_helper: {get_input: cinder_iscsi_helper}
330                 cinder::database_connection: {get_input: cinder_dsn}
331                 cinder::rabbit_userid: {get_input: rabbit_username}
332                 cinder::rabbit_password: {get_input: rabbit_password}
333                 cinder::rabbit_use_ssl: {get_input: rabbit_client_use_ssl}
334                 cinder::rabbit_port: {get_input: rabbit_client_port}
335                 cinder_enable_iscsi_backend: {get_input: cinder_enable_iscsi_backend}
336                 cinder_iscsi_ip_address: {get_input: cinder_iscsi_ip_address}
337                 cinder::glance::glance_api_servers: {get_input: glance_api_servers}
338                 ntp::servers: {get_input: ntp_servers}
339                 timezone::timezone: {get_input: timezone}
340                 tripleo::packages::enable_install: {get_input: enable_package_install}
341                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
342                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
343                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
344
345   # Resource for site-specific injection of root certificate
346   NodeTLSCAData:
347     depends_on: BlockStorageDeployment
348     type: OS::TripleO::NodeTLSCAData
349     properties:
350       server: {get_resource: BlockStorage}
351
352   # Hook for site-specific additional pre-deployment config,
353   # applying to all nodes, e.g node registration/unregistration
354   NodeExtraConfig:
355     depends_on: NodeTLSCAData
356     type: OS::TripleO::NodeExtraConfig
357     properties:
358         server: {get_resource: BlockStorage}
359
360   UpdateConfig:
361     type: OS::TripleO::Tasks::PackageUpdate
362
363   UpdateDeployment:
364     type: OS::Heat::SoftwareDeployment
365     properties:
366       name: UpdateDeployment
367       config: {get_resource: UpdateConfig}
368       server: {get_resource: BlockStorage}
369       input_values:
370         update_identifier:
371           get_param: UpdateIdentifier
372
373 outputs:
374   hosts_entry:
375     value:
376       str_replace:
377         template: |
378           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
379           EXTERNALIP EXTERNALHOST
380           INTERNAL_APIIP INTERNAL_APIHOST
381           STORAGEIP STORAGEHOST
382           STORAGE_MGMTIP STORAGE_MGMTHOST
383           TENANTIP TENANTHOST
384           MANAGEMENTIP MANAGEMENTHOST
385         params:
386           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, BlockStorageHostnameResolveNetwork]}]}
387           DOMAIN: {get_param: CloudDomain}
388           PRIMARYHOST: {get_attr: [BlockStorage, name]}
389           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
390           EXTERNALHOST:
391             list_join:
392             - '-'
393             - - {get_attr: [BlockStorage, name]}
394               - external
395           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
396           INTERNAL_APIHOST:
397             list_join:
398             - '-'
399             - - {get_attr: [BlockStorage, name]}
400               - internalapi
401           STORAGEIP: {get_attr: [StoragePort, ip_address]}
402           STORAGEHOST:
403             list_join:
404             - '-'
405             - - {get_attr: [BlockStorage, name]}
406               - storage
407           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
408           STORAGE_MGMTHOST:
409             list_join:
410             - '-'
411             - - {get_attr: [BlockStorage, name]}
412               - storagemgmt
413           TENANTIP: {get_attr: [TenantPort, ip_address]}
414           TENANTHOST:
415             list_join:
416             - '-'
417             - - {get_attr: [BlockStorage, name]}
418               - tenant
419           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
420           MANAGEMENTHOST:
421             list_join:
422             - '-'
423             - - {get_attr: [BlockStorage, name]}
424               - management
425   nova_server_resource:
426     description: Heat resource handle for the block storage server
427     value:
428       {get_resource: BlockStorage}
429   external_ip_address:
430     description: IP address of the server in the external network
431     value: {get_attr: [ExternalPort, ip_address]}
432   internal_api_ip_address:
433     description: IP address of the server in the internal_api network
434     value: {get_attr: [InternalApiPort, ip_address]}
435   storage_ip_address:
436     description: IP address of the server in the storage network
437     value: {get_attr: [StoragePort, ip_address]}
438   storage_mgmt_ip_address:
439     description: IP address of the server in the storage_mgmt network
440     value: {get_attr: [StorageMgmtPort, ip_address]}
441   tenant_ip_address:
442     description: IP address of the server in the tenant network
443     value: {get_attr: [TenantPort, ip_address]}
444   management_ip_address:
445     description: IP address of the server in the management network
446     value: {get_attr: [ManagementPort, ip_address]}
447   config_identifier:
448     description: identifier which changes if the node configuration may need re-applying
449     value:
450       list_join:
451         - ''
452         - - {get_attr: [BlockStorageDeployment, deploy_stdout]}
453           - {get_attr: [NodeTLSCAData, deploy_stdout]}
454           - {get_param: UpdateIdentifier}