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