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