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