Merge "Use service tenant for ceilometer"
[apex-tripleo-heat-templates.git] / puppet / ceph-storage.yaml
1 heat_template_version: 2015-04-30
2 description: 'OpenStack ceph storage node configured by Puppet'
3 parameters:
4   Flavor:
5     description: Flavor for the Ceph Storage node.
6     type: string
7     constraints:
8       - custom_constraint: nova.flavor
9   Image:
10     type: string
11     default: overcloud-ceph-storage
12     constraints:
13       - custom_constraint: glance.image
14   ImageUpdatePolicy:
15     default: 'REBUILD_PRESERVE_EPHEMERAL'
16     description: What policy to use when reconstructing instances. REBUILD for rebuilds, REBUILD_PRESERVE_EPHEMERAL to preserve /mnt.
17     type: string
18   KeyName:
19     description: Name of an existing Nova key pair to enable SSH access to the instances
20     type: string
21     default: default
22     constraints:
23       - custom_constraint: nova.keypair
24   NtpServer:
25     default: ''
26     description: Comma-separated list of ntp servers
27     type: comma_delimited_list
28   EnablePackageInstall:
29     default: 'false'
30     description: Set to true to enable package installation via Puppet
31     type: boolean
32   ServiceNetMap:
33     default: {}
34     description: Mapping of service_name -> network name. Typically set
35                  via parameter_defaults in the resource registry.
36     type: json
37   TimeZone:
38     default: 'UTC'
39     description: The timezone to be set on Ceph nodes.
40     type: string
41   UpdateIdentifier:
42     default: ''
43     type: string
44     description: >
45       Setting to a previously unused value during stack-update will trigger
46       package update on all nodes
47   Hostname:
48     type: string
49     default: '' # Defaults to Heat created hostname
50   HostnameMap:
51     type: json
52     default: {}
53     description: Optional mapping to override hostnames
54   ExtraConfig:
55     default: {}
56     description: |
57       Additional hiera configuration to inject into the cluster. Note
58       that CephStorageExtraConfig takes precedence over ExtraConfig.
59     type: json
60   CephStorageExtraConfig:
61     default: {}
62     description: |
63       Role specific additional hiera configuration to inject into the cluster.
64     type: json
65   NetworkDeploymentActions:
66     type: comma_delimited_list
67     description: >
68       Heat action when to apply network configuration changes
69     default: ['CREATE']
70   SoftwareConfigTransport:
71     default: POLL_SERVER_CFN
72     description: |
73       How the server should receive the metadata required for software configuration.
74     type: string
75     constraints:
76     - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
77   CloudDomain:
78     default: ''
79     type: string
80     description: >
81       The DNS domain used for the hosts. This should match the dhcp_domain
82       configured in the Undercloud neutron. Defaults to localdomain.
83   ServerMetadata:
84     default: {}
85     description: >
86       Extra properties or metadata passed to Nova for the created nodes in
87       the overcloud. It's accessible via the Nova metadata API.
88     type: json
89   SchedulerHints:
90     type: json
91     description: Optional scheduler hints to pass to nova
92     default: {}
93
94 resources:
95   CephStorage:
96     type: OS::Nova::Server
97     properties:
98       image: {get_param: Image}
99       image_update_policy: {get_param: ImageUpdatePolicy}
100       flavor: {get_param: Flavor}
101       key_name: {get_param: KeyName}
102       networks:
103         - network: ctlplane
104       user_data_format: SOFTWARE_CONFIG
105       user_data: {get_resource: UserData}
106       name:
107         str_replace:
108             template: {get_param: Hostname}
109             params: {get_param: HostnameMap}
110       software_config_transport: {get_param: SoftwareConfigTransport}
111       metadata: {get_param: ServerMetadata}
112       scheduler_hints: {get_param: SchedulerHints}
113
114   # Combine the NodeAdminUserData and NodeUserData mime archives
115   UserData:
116     type: OS::Heat::MultipartMime
117     properties:
118       parts:
119       - config: {get_resource: NodeAdminUserData}
120         type: multipart
121       - config: {get_resource: NodeUserData}
122         type: multipart
123
124   # Creates the "heat-admin" user if configured via the environment
125   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
126   NodeAdminUserData:
127     type: OS::TripleO::NodeAdminUserData
128
129   # For optional operator additional userdata
130   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
131   NodeUserData:
132     type: OS::TripleO::NodeUserData
133
134   ExternalPort:
135     type: OS::TripleO::CephStorage::Ports::ExternalPort
136     properties:
137       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
138
139   InternalApiPort:
140     type: OS::TripleO::CephStorage::Ports::InternalApiPort
141     properties:
142       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
143
144   StoragePort:
145     type: OS::TripleO::CephStorage::Ports::StoragePort
146     properties:
147       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
148
149   StorageMgmtPort:
150     type: OS::TripleO::CephStorage::Ports::StorageMgmtPort
151     properties:
152       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
153
154   TenantPort:
155     type: OS::TripleO::CephStorage::Ports::TenantPort
156     properties:
157       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
158
159   ManagementPort:
160     type: OS::TripleO::CephStorage::Ports::ManagementPort
161     properties:
162       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
163
164   NetworkConfig:
165     type: OS::TripleO::CephStorage::Net::SoftwareConfig
166     properties:
167       ControlPlaneIp: {get_attr: [CephStorage, networks, ctlplane, 0]}
168       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
169       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
170       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
171       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
172       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
173       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
174
175   NetIpMap:
176     type: OS::TripleO::Network::Ports::NetIpMap
177     properties:
178       ControlPlaneIp: {get_attr: [CephStorage, networks, ctlplane, 0]}
179       ExternalIp: {get_attr: [ExternalPort, ip_address]}
180       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
181       StorageIp: {get_attr: [StoragePort, ip_address]}
182       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
183       TenantIp: {get_attr: [TenantPort, ip_address]}
184       ManagementIp: {get_attr: [ManagementPort, ip_address]}
185
186   NetIpSubnetMap:
187     type: OS::TripleO::Network::Ports::NetIpSubnetMap
188     properties:
189       ControlPlaneIp: {get_attr: [CephStorage, networks, ctlplane, 0]}
190       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
191       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
192       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
193       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
194       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
195       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
196
197   NetworkDeployment:
198     type: OS::TripleO::SoftwareDeployment
199     properties:
200       name: NetworkDeployment
201       config: {get_resource: NetworkConfig}
202       server: {get_resource: CephStorage}
203       actions: {get_param: NetworkDeploymentActions}
204
205   CephStorageDeployment:
206     type: OS::Heat::StructuredDeployment
207     depends_on: NetworkDeployment
208     properties:
209       name: CephStorageDeployment
210       config: {get_resource: CephStorageConfig}
211       server: {get_resource: CephStorage}
212       input_values:
213         ntp_servers: {get_param: NtpServer}
214         timezone: {get_param: TimeZone}
215         enable_package_install: {get_param: EnablePackageInstall}
216         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
217         ceph_cluster_network: {get_attr: [NetIpSubnetMap, net_ip_subnet_map, {get_param: [ServiceNetMap, CephClusterNetwork]}]}
218         ceph_public_network: {get_attr: [NetIpSubnetMap, net_ip_subnet_map, {get_param: [ServiceNetMap, CephPublicNetwork]}]}
219
220   CephStorageConfig:
221     type: OS::Heat::StructuredConfig
222     properties:
223       group: os-apply-config
224       config:
225         hiera:
226           hierarchy:
227             - '"%{::uuid}"'
228             - heat_config_%{::deploy_config_name}
229             - ceph_extraconfig
230             - extraconfig
231             - ceph_cluster # provided by CephClusterConfig
232             - ceph
233             - '"%{::osfamily}"'
234             - common
235           datafiles:
236             common:
237               raw_data: {get_file: hieradata/common.yaml}
238             ceph_extraconfig:
239               mapped_data: {get_param: CephStorageExtraConfig}
240             extraconfig:
241               mapped_data: {get_param: ExtraConfig}
242             ceph:
243               raw_data: {get_file: hieradata/ceph.yaml}
244               mapped_data:
245                 ntp::servers: {get_input: ntp_servers}
246                 timezone::timezone: {get_input: timezone}
247                 tripleo::packages::enable_install: {get_input: enable_package_install}
248                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
249                 ceph::profile::params::cluster_network: {get_input: ceph_cluster_network}
250                 ceph::profile::params::public_network: {get_input: ceph_public_network}
251
252   # Resource for site-specific injection of root certificate
253   NodeTLSCAData:
254     depends_on: CephStorageDeployment
255     type: OS::TripleO::NodeTLSCAData
256     properties:
257       server: {get_resource: CephStorage}
258
259   # Hook for site-specific additional pre-deployment config, e.g extra hieradata
260   CephStorageExtraConfigPre:
261     depends_on: CephStorageDeployment
262     type: OS::TripleO::CephStorageExtraConfigPre
263     properties:
264         server: {get_resource: CephStorage}
265
266   # Hook for site-specific additional pre-deployment config,
267   # applying to all nodes, e.g node registration/unregistration
268   NodeExtraConfig:
269     depends_on: [CephStorageExtraConfigPre, NodeTLSCAData]
270     type: OS::TripleO::NodeExtraConfig
271     properties:
272         server: {get_resource: CephStorage}
273
274   UpdateConfig:
275     type: OS::TripleO::Tasks::PackageUpdate
276
277   UpdateDeployment:
278     type: OS::Heat::SoftwareDeployment
279     properties:
280       config: {get_resource: UpdateConfig}
281       server: {get_resource: CephStorage}
282       input_values:
283         update_identifier:
284           get_param: UpdateIdentifier
285
286 outputs:
287   hosts_entry:
288     value:
289       str_replace:
290         template: |
291           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
292           EXTERNALIP EXTERNALHOST
293           INTERNAL_APIIP INTERNAL_APIHOST
294           STORAGEIP STORAGEHOST
295           STORAGE_MGMTIP STORAGE_MGMTHOST
296           TENANTIP TENANTHOST
297           MANAGEMENTIP MANAGEMENTHOST
298         params:
299           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, CephStorageHostnameResolveNetwork]}]}
300           DOMAIN: {get_param: CloudDomain}
301           PRIMARYHOST: {get_attr: [CephStorage, name]}
302           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
303           EXTERNALHOST:
304             list_join:
305             - '-'
306             - - {get_attr: [CephStorage, name]}
307               - external
308           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
309           INTERNAL_APIHOST:
310             list_join:
311             - '-'
312             - - {get_attr: [CephStorage, name]}
313               - internalapi
314           STORAGEIP: {get_attr: [StoragePort, ip_address]}
315           STORAGEHOST:
316             list_join:
317             - '-'
318             - - {get_attr: [CephStorage, name]}
319               - storage
320           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
321           STORAGE_MGMTHOST:
322             list_join:
323             - '-'
324             - - {get_attr: [CephStorage, name]}
325               - storagemgmt
326           TENANTIP: {get_attr: [TenantPort, ip_address]}
327           TENANTHOST:
328             list_join:
329             - '-'
330             - - {get_attr: [CephStorage, name]}
331               - tenant
332           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
333           MANAGEMENTHOST:
334             list_join:
335             - '-'
336             - - {get_attr: [CephStorage, name]}
337               - management
338   nova_server_resource:
339     description: Heat resource handle for the ceph storage server
340     value:
341       {get_resource: CephStorage}
342   external_ip_address:
343     description: IP address of the server in the external network
344     value: {get_attr: [ExternalPort, ip_address]}
345   internal_api_ip_address:
346     description: IP address of the server in the internal_api network
347     value: {get_attr: [InternalApiPort, ip_address]}
348   storage_ip_address:
349     description: IP address of the server in the storage network
350     value: {get_attr: [StoragePort, ip_address]}
351   storage_mgmt_ip_address:
352     description: IP address of the server in the storage_mgmt network
353     value: {get_attr: [StorageMgmtPort, ip_address]}
354   tenant_ip_address:
355     description: IP address of the server in the tenant network
356     value: {get_attr: [TenantPort, ip_address]}
357   management_ip_address:
358     description: IP address of the server in the management network
359     value: {get_attr: [ManagementPort, ip_address]}
360   config_identifier:
361     description: identifier which changes if the node configuration may need re-applying
362     value:
363       list_join:
364       - ','
365       - - {get_attr: [CephStorageDeployment, deploy_stdout]}
366         - {get_attr: [NodeTLSCAData, deploy_stdout]}
367         - {get_attr: [CephStorageExtraConfigPre, deploy_stdout]}
368         - {get_param: UpdateIdentifier}