ba84fb775bea07a640185bf40b10faa7c2a121ba
[apex-tripleo-heat-templates.git] / puppet / cinder-storage.yaml
1 heat_template_version: 2016-10-14
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     type: string
77     description: >
78       The DNS domain used for the hosts. This should match the dhcp_domain
79       configured in the Undercloud neutron. Defaults to localdomain.
80   ServerMetadata:
81     default: {}
82     description: >
83       Extra properties or metadata passed to Nova for the created nodes in
84       the overcloud. It's accessible via the Nova metadata API.
85     type: json
86   BlockStorageSchedulerHints:
87     type: json
88     description: Optional scheduler hints to pass to nova
89     default: {}
90   NodeIndex:
91     type: number
92     default: 0
93   ServiceConfigSettings:
94     type: json
95     default: {}
96   ServiceNames:
97     type: comma_delimited_list
98     default: []
99   ConfigCommand:
100     type: string
101     description: Command which will be run whenever configuration data changes
102     default: os-refresh-config --timeout 14400
103
104 resources:
105   BlockStorage:
106     type: OS::TripleO::Server
107     metadata:
108       os-collect-config:
109         command: {get_param: ConfigCommand}
110     properties:
111       image:
112         {get_param: BlockStorageImage}
113       flavor: {get_param: Flavor}
114       key_name: {get_param: KeyName}
115       networks:
116         - network: ctlplane
117       user_data_format: SOFTWARE_CONFIG
118       user_data: {get_resource: UserData}
119       name:
120         str_replace:
121             template: {get_param: Hostname}
122             params: {get_param: HostnameMap}
123       software_config_transport: {get_param: SoftwareConfigTransport}
124       metadata: {get_param: ServerMetadata}
125       scheduler_hints: {get_param: BlockStorageSchedulerHints}
126
127   # Combine the NodeAdminUserData and NodeUserData mime archives
128   UserData:
129     type: OS::Heat::MultipartMime
130     properties:
131       parts:
132       - config: {get_resource: NodeAdminUserData}
133         type: multipart
134       - config: {get_resource: NodeUserData}
135         type: multipart
136
137   # Creates the "heat-admin" user if configured via the environment
138   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
139   NodeAdminUserData:
140     type: OS::TripleO::NodeAdminUserData
141
142   # For optional operator additional userdata
143   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
144   NodeUserData:
145     type: OS::TripleO::NodeUserData
146
147   ExternalPort:
148     type: OS::TripleO::BlockStorage::Ports::ExternalPort
149     properties:
150       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
151       IPPool: {get_param: BlockStorageIPs}
152       NodeIndex: {get_param: NodeIndex}
153
154   InternalApiPort:
155     type: OS::TripleO::BlockStorage::Ports::InternalApiPort
156     properties:
157       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
158       IPPool: {get_param: BlockStorageIPs}
159       NodeIndex: {get_param: NodeIndex}
160
161   StoragePort:
162     type: OS::TripleO::BlockStorage::Ports::StoragePort
163     properties:
164       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
165       IPPool: {get_param: BlockStorageIPs}
166       NodeIndex: {get_param: NodeIndex}
167
168   StorageMgmtPort:
169     type: OS::TripleO::BlockStorage::Ports::StorageMgmtPort
170     properties:
171       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
172       IPPool: {get_param: BlockStorageIPs}
173       NodeIndex: {get_param: NodeIndex}
174
175   TenantPort:
176     type: OS::TripleO::BlockStorage::Ports::TenantPort
177     properties:
178       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
179       IPPool: {get_param: BlockStorageIPs}
180       NodeIndex: {get_param: NodeIndex}
181
182   ManagementPort:
183     type: OS::TripleO::BlockStorage::Ports::ManagementPort
184     properties:
185       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
186       IPPool: {get_param: BlockStorageIPs}
187       NodeIndex: {get_param: NodeIndex}
188
189   NetworkConfig:
190     type: OS::TripleO::BlockStorage::Net::SoftwareConfig
191     properties:
192       ControlPlaneIp: {get_attr: [BlockStorage, networks, ctlplane, 0]}
193       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
194       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
195       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
196       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
197       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
198       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
199
200   NetIpMap:
201     type: OS::TripleO::Network::Ports::NetIpMap
202     properties:
203       ControlPlaneIp: {get_attr: [BlockStorage, networks, ctlplane, 0]}
204       ExternalIp: {get_attr: [ExternalPort, ip_address]}
205       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
206       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
207       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
208       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
209       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
210       StorageIp: {get_attr: [StoragePort, ip_address]}
211       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
212       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
213       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
214       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
215       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
216       TenantIp: {get_attr: [TenantPort, ip_address]}
217       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
218       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
219       ManagementIp: {get_attr: [ManagementPort, ip_address]}
220       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
221       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
222
223   NetworkDeployment:
224     type: OS::TripleO::SoftwareDeployment
225     properties:
226       name: NetworkDeployment
227       config: {get_resource: NetworkConfig}
228       server: {get_resource: BlockStorage}
229       actions: {get_param: NetworkDeploymentActions}
230
231   BlockStorageDeployment:
232     type: OS::Heat::StructuredDeployment
233     depends_on: NetworkDeployment
234     properties:
235       name: BlockStorageDeployment
236       server: {get_resource: BlockStorage}
237       config: {get_resource: BlockStorageConfig}
238       input_values:
239         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
240         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
241         cinder_iscsi_ip_address:
242           str_replace:
243             template: "'IP'"
244             params:
245               IP: {get_attr: [NetIpMap, net_ip_uri_map, {get_param: [ServiceNetMap, CinderIscsiNetwork]}]}
246         enable_package_install: {get_param: EnablePackageInstall}
247         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
248
249   # Map heat metadata into hiera datafiles
250   BlockStorageConfig:
251     type: OS::Heat::StructuredConfig
252     properties:
253       group: os-apply-config
254       config:
255         hiera:
256           hierarchy:
257             - '"%{::uuid}"'
258             - heat_config_%{::deploy_config_name}
259             - volume_extraconfig
260             - extraconfig
261             - service_names
262             - service_configs
263             - volume
264             - all_nodes # provided by allNodesConfig
265             - '"%{::osfamily}"'
266             - network
267           merge_behavior: deeper
268           datafiles:
269             service_names:
270               mapped_data:
271                 service_names: {get_param: ServiceNames}
272             service_configs:
273               mapped_data:
274                 map_replace:
275                   - {get_param: ServiceConfigSettings}
276                   - values: {get_attr: [NetIpMap, net_ip_map]}
277             network:
278               mapped_data:
279                 net_ip_map: {get_attr: [NetIpMap, net_ip_map]}
280                 net_ip_subnet_map: {get_attr: [NetIpMap, net_ip_subnet_map]}
281                 net_ip_uri_map: {get_attr: [NetIpMap, net_ip_uri_map]}
282             volume_extraconfig:
283               mapped_data: {get_param: BlockStorageExtraConfig}
284             extraconfig:
285               mapped_data: {get_param: ExtraConfig}
286             volume:
287               mapped_data:
288                 # Cinder
289                 tripleo::profile::base::cinder::volume::iscsi::cinder_iscsi_ip_address: {get_input: cinder_iscsi_ip_address}
290                 tripleo::packages::enable_install: {get_input: enable_package_install}
291                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
292                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
293                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
294
295   # Resource for site-specific injection of root certificate
296   NodeTLSCAData:
297     depends_on: BlockStorageDeployment
298     type: OS::TripleO::NodeTLSCAData
299     properties:
300       server: {get_resource: BlockStorage}
301
302   # Hook for site-specific additional pre-deployment config,
303   # applying to all nodes, e.g node registration/unregistration
304   NodeExtraConfig:
305     depends_on: NodeTLSCAData
306     type: OS::TripleO::NodeExtraConfig
307     properties:
308         server: {get_resource: BlockStorage}
309
310   UpdateConfig:
311     type: OS::TripleO::Tasks::PackageUpdate
312
313   UpdateDeployment:
314     type: OS::Heat::SoftwareDeployment
315     properties:
316       name: UpdateDeployment
317       config: {get_resource: UpdateConfig}
318       server: {get_resource: BlockStorage}
319       input_values:
320         update_identifier:
321           get_param: UpdateIdentifier
322
323 outputs:
324   ip_address:
325     description: IP address of the server in the ctlplane network
326     value: {get_attr: [BlockStorage, networks, ctlplane, 0]}
327   hostname:
328     description: Hostname of the server
329     value: {get_attr: [BlockStorage, name]}
330   hosts_entry:
331     value:
332       str_replace:
333         template: |
334           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
335           EXTERNALIP EXTERNALHOST.DOMAIN EXTERNALHOST
336           INTERNAL_APIIP INTERNAL_APIHOST.DOMAIN INTERNAL_APIHOST
337           STORAGEIP STORAGEHOST.DOMAIN STORAGEHOST
338           STORAGE_MGMTIP STORAGE_MGMTHOST.DOMAIN STORAGE_MGMTHOST
339           TENANTIP TENANTHOST.DOMAIN TENANTHOST
340           MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
341         params:
342           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, BlockStorageHostnameResolveNetwork]}]}
343           DOMAIN: {get_param: CloudDomain}
344           PRIMARYHOST: {get_attr: [BlockStorage, name]}
345           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
346           EXTERNALHOST:
347             list_join:
348             - '.'
349             - - {get_attr: [BlockStorage, name]}
350               - external
351           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
352           INTERNAL_APIHOST:
353             list_join:
354             - '.'
355             - - {get_attr: [BlockStorage, name]}
356               - internalapi
357           STORAGEIP: {get_attr: [StoragePort, ip_address]}
358           STORAGEHOST:
359             list_join:
360             - '.'
361             - - {get_attr: [BlockStorage, name]}
362               - storage
363           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
364           STORAGE_MGMTHOST:
365             list_join:
366             - '.'
367             - - {get_attr: [BlockStorage, name]}
368               - storagemgmt
369           TENANTIP: {get_attr: [TenantPort, ip_address]}
370           TENANTHOST:
371             list_join:
372             - '.'
373             - - {get_attr: [BlockStorage, name]}
374               - tenant
375           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
376           MANAGEMENTHOST:
377             list_join:
378             - '.'
379             - - {get_attr: [BlockStorage, name]}
380               - management
381   nova_server_resource:
382     description: Heat resource handle for the block storage server
383     value:
384       {get_resource: BlockStorage}
385   external_ip_address:
386     description: IP address of the server in the external network
387     value: {get_attr: [ExternalPort, ip_address]}
388   internal_api_ip_address:
389     description: IP address of the server in the internal_api network
390     value: {get_attr: [InternalApiPort, ip_address]}
391   storage_ip_address:
392     description: IP address of the server in the storage network
393     value: {get_attr: [StoragePort, ip_address]}
394   storage_mgmt_ip_address:
395     description: IP address of the server in the storage_mgmt network
396     value: {get_attr: [StorageMgmtPort, ip_address]}
397   tenant_ip_address:
398     description: IP address of the server in the tenant network
399     value: {get_attr: [TenantPort, ip_address]}
400   management_ip_address:
401     description: IP address of the server in the management network
402     value: {get_attr: [ManagementPort, ip_address]}