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