Merge "Set proper ceph config path for manila"
[apex-tripleo-heat-templates.git] / puppet / blockstorage-role.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   UpdateIdentifier:
34     default: ''
35     type: string
36     description: >
37       Setting to a previously unused value during stack-update will trigger
38       package update on all nodes
39   Hostname:
40     type: string
41     default: '' # Defaults to Heat created hostname
42   HostnameMap:
43     type: json
44     default: {}
45     description: Optional mapping to override hostnames
46   ServiceNetMap:
47     default: {}
48     description: Mapping of service_name -> network name. Typically set
49                  via parameter_defaults in the resource registry.
50     type: json
51   EndpointMap:
52     default: {}
53     description: Mapping of service endpoint -> protocol. Typically set
54                  via parameter_defaults in the resource registry.
55     type: json
56   NetworkDeploymentActions:
57     type: comma_delimited_list
58     description: >
59       Heat action when to apply network configuration changes
60     default: ['CREATE']
61   SoftwareConfigTransport:
62     default: POLL_SERVER_CFN
63     description: |
64       How the server should receive the metadata required for software configuration.
65     type: string
66     constraints:
67     - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
68   CloudDomain:
69     type: string
70     description: >
71       The DNS domain used for the hosts. This should match the dhcp_domain
72       configured in the Undercloud neutron. Defaults to localdomain.
73   ServerMetadata:
74     default: {}
75     description: >
76       Extra properties or metadata passed to Nova for the created nodes in
77       the overcloud. It's accessible via the Nova metadata API.
78     type: json
79   BlockStorageSchedulerHints:
80     type: json
81     description: Optional scheduler hints to pass to nova
82     default: {}
83   NodeIndex:
84     type: number
85     default: 0
86   ServiceConfigSettings:
87     type: json
88     default: {}
89   ServiceNames:
90     type: comma_delimited_list
91     default: []
92   MonitoringSubscriptions:
93     type: comma_delimited_list
94     default: []
95   ConfigCommand:
96     type: string
97     description: Command which will be run whenever configuration data changes
98     default: os-refresh-config --timeout 14400
99   LoggingSources:
100     type: json
101     default: []
102   LoggingGroups:
103     type: comma_delimited_list
104     default: []
105
106 resources:
107   BlockStorage:
108     type: OS::TripleO::Server
109     metadata:
110       os-collect-config:
111         command: {get_param: ConfigCommand}
112     properties:
113       image:
114         {get_param: BlockStorageImage}
115       flavor: {get_param: OvercloudBlockStorageFlavor}
116       key_name: {get_param: KeyName}
117       networks:
118         - network: ctlplane
119       user_data_format: SOFTWARE_CONFIG
120       user_data: {get_resource: UserData}
121       name:
122         str_replace:
123             template: {get_param: Hostname}
124             params: {get_param: HostnameMap}
125       software_config_transport: {get_param: SoftwareConfigTransport}
126       metadata: {get_param: ServerMetadata}
127       scheduler_hints: {get_param: BlockStorageSchedulerHints}
128
129   # Combine the NodeAdminUserData and NodeUserData mime archives
130   UserData:
131     type: OS::Heat::MultipartMime
132     properties:
133       parts:
134       - config: {get_resource: NodeAdminUserData}
135         type: multipart
136       - config: {get_resource: NodeUserData}
137         type: multipart
138
139   # Creates the "heat-admin" user if configured via the environment
140   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
141   NodeAdminUserData:
142     type: OS::TripleO::NodeAdminUserData
143
144   # For optional operator additional userdata
145   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
146   NodeUserData:
147     type: OS::TripleO::NodeUserData
148
149   ExternalPort:
150     type: OS::TripleO::BlockStorage::Ports::ExternalPort
151     properties:
152       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
153       IPPool: {get_param: BlockStorageIPs}
154       NodeIndex: {get_param: NodeIndex}
155
156   InternalApiPort:
157     type: OS::TripleO::BlockStorage::Ports::InternalApiPort
158     properties:
159       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
160       IPPool: {get_param: BlockStorageIPs}
161       NodeIndex: {get_param: NodeIndex}
162
163   StoragePort:
164     type: OS::TripleO::BlockStorage::Ports::StoragePort
165     properties:
166       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
167       IPPool: {get_param: BlockStorageIPs}
168       NodeIndex: {get_param: NodeIndex}
169
170   StorageMgmtPort:
171     type: OS::TripleO::BlockStorage::Ports::StorageMgmtPort
172     properties:
173       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
174       IPPool: {get_param: BlockStorageIPs}
175       NodeIndex: {get_param: NodeIndex}
176
177   TenantPort:
178     type: OS::TripleO::BlockStorage::Ports::TenantPort
179     properties:
180       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
181       IPPool: {get_param: BlockStorageIPs}
182       NodeIndex: {get_param: NodeIndex}
183
184   ManagementPort:
185     type: OS::TripleO::BlockStorage::Ports::ManagementPort
186     properties:
187       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
188       IPPool: {get_param: BlockStorageIPs}
189       NodeIndex: {get_param: NodeIndex}
190
191   NetworkConfig:
192     type: OS::TripleO::BlockStorage::Net::SoftwareConfig
193     properties:
194       ControlPlaneIp: {get_attr: [BlockStorage, networks, ctlplane, 0]}
195       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
196       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
197       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
198       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
199       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
200       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
201
202   NetIpMap:
203     type: OS::TripleO::Network::Ports::NetIpMap
204     properties:
205       ControlPlaneIp: {get_attr: [BlockStorage, networks, ctlplane, 0]}
206       ExternalIp: {get_attr: [ExternalPort, ip_address]}
207       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
208       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
209       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
210       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
211       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
212       StorageIp: {get_attr: [StoragePort, ip_address]}
213       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
214       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
215       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
216       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
217       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
218       TenantIp: {get_attr: [TenantPort, ip_address]}
219       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
220       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
221       ManagementIp: {get_attr: [ManagementPort, ip_address]}
222       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
223       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
224
225   NetworkDeployment:
226     type: OS::TripleO::SoftwareDeployment
227     properties:
228       name: NetworkDeployment
229       config: {get_resource: NetworkConfig}
230       server: {get_resource: BlockStorage}
231       actions: {get_param: NetworkDeploymentActions}
232
233   BlockStorageDeployment:
234     type: OS::Heat::StructuredDeployment
235     depends_on: NetworkDeployment
236     properties:
237       name: BlockStorageDeployment
238       server: {get_resource: BlockStorage}
239       config: {get_resource: BlockStorageConfig}
240       input_values:
241         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
242
243   # Map heat metadata into hiera datafiles
244   BlockStorageConfig:
245     type: OS::Heat::StructuredConfig
246     properties:
247       group: os-apply-config
248       config:
249         hiera:
250           hierarchy:
251             - '"%{::uuid}"'
252             - heat_config_%{::deploy_config_name}
253             - volume_extraconfig
254             - extraconfig
255             - service_names
256             - service_configs
257             - volume
258             - bootstrap_node # provided by allNodesConfig
259             - all_nodes # provided by allNodesConfig
260             - vip_data # provided by allNodesConfig
261             - '"%{::osfamily}"'
262           merge_behavior: deeper
263           datafiles:
264             service_names:
265               mapped_data:
266                 service_names: {get_param: ServiceNames}
267                 sensu::subscriptions: {get_param: MonitoringSubscriptions}
268             service_configs:
269               mapped_data:
270                 map_replace:
271                   - {get_param: ServiceConfigSettings}
272                   - values: {get_attr: [NetIpMap, net_ip_map]}
273             volume_extraconfig:
274               mapped_data: {get_param: BlockStorageExtraConfig}
275             extraconfig:
276               mapped_data: {get_param: ExtraConfig}
277             volume:
278               mapped_data:
279                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
280                 tripleo::profile::base::logging::fluentd::fluentd_sources: {get_param: LoggingSources}
281                 tripleo::profile::base::logging::fluentd::fluentd_groups: {get_param: LoggingGroups}
282
283   # Resource for site-specific injection of root certificate
284   NodeTLSCAData:
285     depends_on: BlockStorageDeployment
286     type: OS::TripleO::NodeTLSCAData
287     properties:
288       server: {get_resource: BlockStorage}
289
290   # Hook for site-specific additional pre-deployment config,
291   # applying to all nodes, e.g node registration/unregistration
292   NodeExtraConfig:
293     depends_on: NodeTLSCAData
294     type: OS::TripleO::NodeExtraConfig
295     properties:
296         server: {get_resource: BlockStorage}
297
298   UpdateConfig:
299     type: OS::TripleO::Tasks::PackageUpdate
300
301   UpdateDeployment:
302     type: OS::Heat::SoftwareDeployment
303     properties:
304       name: UpdateDeployment
305       config: {get_resource: UpdateConfig}
306       server: {get_resource: BlockStorage}
307       input_values:
308         update_identifier:
309           get_param: UpdateIdentifier
310
311 outputs:
312   ip_address:
313     description: IP address of the server in the ctlplane network
314     value: {get_attr: [BlockStorage, networks, ctlplane, 0]}
315   hostname:
316     description: Hostname of the server
317     value: {get_attr: [BlockStorage, name]}
318   hostname_map:
319     description: Mapping of network names to hostnames
320     value:
321       external:
322         list_join:
323         - '.'
324         - - {get_attr: [BlockStorage, name]}
325           - external
326           - {get_param: CloudDomain}
327       internal_api:
328         list_join:
329         - '.'
330         - - {get_attr: [BlockStorage, name]}
331           - internalapi
332           - {get_param: CloudDomain}
333       storage:
334         list_join:
335         - '.'
336         - - {get_attr: [BlockStorage, name]}
337           - storage
338           - {get_param: CloudDomain}
339       storage_mgmt:
340         list_join:
341         - '.'
342         - - {get_attr: [BlockStorage, name]}
343           - storagemgmt
344           - {get_param: CloudDomain}
345       tenant:
346         list_join:
347         - '.'
348         - - {get_attr: [BlockStorage, name]}
349           - tenant
350           - {get_param: CloudDomain}
351       management:
352         list_join:
353         - '.'
354         - - {get_attr: [BlockStorage, name]}
355           - management
356           - {get_param: CloudDomain}
357       ctlplane:
358         list_join:
359         - '.'
360         - - {get_attr: [BlockStorage, name]}
361           - ctlplane
362           - {get_param: CloudDomain}
363   hosts_entry:
364     value:
365       str_replace:
366         template: |
367           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
368           EXTERNALIP EXTERNALHOST.DOMAIN EXTERNALHOST
369           INTERNAL_APIIP INTERNAL_APIHOST.DOMAIN INTERNAL_APIHOST
370           STORAGEIP STORAGEHOST.DOMAIN STORAGEHOST
371           STORAGE_MGMTIP STORAGE_MGMTHOST.DOMAIN STORAGE_MGMTHOST
372           TENANTIP TENANTHOST.DOMAIN TENANTHOST
373           MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
374           CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
375         params:
376           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, BlockStorageHostnameResolveNetwork]}]}
377           DOMAIN: {get_param: CloudDomain}
378           PRIMARYHOST: {get_attr: [BlockStorage, name]}
379           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
380           EXTERNALHOST:
381             list_join:
382             - '.'
383             - - {get_attr: [BlockStorage, name]}
384               - external
385           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
386           INTERNAL_APIHOST:
387             list_join:
388             - '.'
389             - - {get_attr: [BlockStorage, name]}
390               - internalapi
391           STORAGEIP: {get_attr: [StoragePort, ip_address]}
392           STORAGEHOST:
393             list_join:
394             - '.'
395             - - {get_attr: [BlockStorage, name]}
396               - storage
397           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
398           STORAGE_MGMTHOST:
399             list_join:
400             - '.'
401             - - {get_attr: [BlockStorage, name]}
402               - storagemgmt
403           TENANTIP: {get_attr: [TenantPort, ip_address]}
404           TENANTHOST:
405             list_join:
406             - '.'
407             - - {get_attr: [BlockStorage, name]}
408               - tenant
409           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
410           MANAGEMENTHOST:
411             list_join:
412             - '.'
413             - - {get_attr: [BlockStorage, name]}
414               - management
415           CTLPLANEIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
416           CTLPLANEHOST:
417             list_join:
418             - '.'
419             - - {get_attr: [BlockStorage, name]}
420               - ctlplane
421   nova_server_resource:
422     description: Heat resource handle for the block storage server
423     value:
424       {get_resource: BlockStorage}
425   external_ip_address:
426     description: IP address of the server in the external network
427     value: {get_attr: [ExternalPort, ip_address]}
428   internal_api_ip_address:
429     description: IP address of the server in the internal_api network
430     value: {get_attr: [InternalApiPort, ip_address]}
431   storage_ip_address:
432     description: IP address of the server in the storage network
433     value: {get_attr: [StoragePort, ip_address]}
434   storage_mgmt_ip_address:
435     description: IP address of the server in the storage_mgmt network
436     value: {get_attr: [StorageMgmtPort, ip_address]}
437   tenant_ip_address:
438     description: IP address of the server in the tenant network
439     value: {get_attr: [TenantPort, ip_address]}
440   management_ip_address:
441     description: IP address of the server in the management network
442     value: {get_attr: [ManagementPort, ip_address]}