Merge "Add missing createUser line to /etc/snmp/snmpd.conf"
[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       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
181       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
182       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
183       StorageIp: {get_attr: [StoragePort, ip_address]}
184       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
185       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
186       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
187       TenantIp: {get_attr: [TenantPort, ip_address]}
188       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
189       ManagementIp: {get_attr: [ManagementPort, ip_address]}
190       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
191
192   NetIpSubnetMap:
193     type: OS::TripleO::Network::Ports::NetIpSubnetMap
194     properties:
195       ControlPlaneIp: {get_attr: [CephStorage, networks, ctlplane, 0]}
196       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
197       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
198       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
199       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
200       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
201       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
202
203   NetworkDeployment:
204     type: OS::TripleO::SoftwareDeployment
205     properties:
206       name: NetworkDeployment
207       config: {get_resource: NetworkConfig}
208       server: {get_resource: CephStorage}
209       actions: {get_param: NetworkDeploymentActions}
210
211   CephStorageDeployment:
212     type: OS::Heat::StructuredDeployment
213     depends_on: NetworkDeployment
214     properties:
215       name: CephStorageDeployment
216       config: {get_resource: CephStorageConfig}
217       server: {get_resource: CephStorage}
218       input_values:
219         ntp_servers: {get_param: NtpServer}
220         timezone: {get_param: TimeZone}
221         enable_package_install: {get_param: EnablePackageInstall}
222         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
223         ceph_cluster_network: {get_attr: [NetIpSubnetMap, net_ip_subnet_map, {get_param: [ServiceNetMap, CephClusterNetwork]}]}
224         ceph_public_network: {get_attr: [NetIpSubnetMap, net_ip_subnet_map, {get_param: [ServiceNetMap, CephPublicNetwork]}]}
225
226   CephStorageConfig:
227     type: OS::Heat::StructuredConfig
228     properties:
229       group: os-apply-config
230       config:
231         hiera:
232           hierarchy:
233             - '"%{::uuid}"'
234             - heat_config_%{::deploy_config_name}
235             - ceph_extraconfig
236             - extraconfig
237             - ceph_cluster # provided by CephClusterConfig
238             - ceph
239             - '"%{::osfamily}"'
240             - common
241           datafiles:
242             common:
243               raw_data: {get_file: hieradata/common.yaml}
244             ceph_extraconfig:
245               mapped_data: {get_param: CephStorageExtraConfig}
246             extraconfig:
247               mapped_data: {get_param: ExtraConfig}
248             ceph:
249               raw_data: {get_file: hieradata/ceph.yaml}
250               mapped_data:
251                 ntp::servers: {get_input: ntp_servers}
252                 timezone::timezone: {get_input: timezone}
253                 tripleo::packages::enable_install: {get_input: enable_package_install}
254                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
255                 ceph::profile::params::cluster_network: {get_input: ceph_cluster_network}
256                 ceph::profile::params::public_network: {get_input: ceph_public_network}
257
258   # Resource for site-specific injection of root certificate
259   NodeTLSCAData:
260     depends_on: CephStorageDeployment
261     type: OS::TripleO::NodeTLSCAData
262     properties:
263       server: {get_resource: CephStorage}
264
265   # Hook for site-specific additional pre-deployment config, e.g extra hieradata
266   CephStorageExtraConfigPre:
267     depends_on: CephStorageDeployment
268     type: OS::TripleO::CephStorageExtraConfigPre
269     properties:
270         server: {get_resource: CephStorage}
271
272   # Hook for site-specific additional pre-deployment config,
273   # applying to all nodes, e.g node registration/unregistration
274   NodeExtraConfig:
275     depends_on: [CephStorageExtraConfigPre, NodeTLSCAData]
276     type: OS::TripleO::NodeExtraConfig
277     properties:
278         server: {get_resource: CephStorage}
279
280   UpdateConfig:
281     type: OS::TripleO::Tasks::PackageUpdate
282
283   UpdateDeployment:
284     type: OS::Heat::SoftwareDeployment
285     properties:
286       config: {get_resource: UpdateConfig}
287       server: {get_resource: CephStorage}
288       input_values:
289         update_identifier:
290           get_param: UpdateIdentifier
291
292 outputs:
293   hosts_entry:
294     value:
295       str_replace:
296         template: |
297           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
298           EXTERNALIP EXTERNALHOST
299           INTERNAL_APIIP INTERNAL_APIHOST
300           STORAGEIP STORAGEHOST
301           STORAGE_MGMTIP STORAGE_MGMTHOST
302           TENANTIP TENANTHOST
303           MANAGEMENTIP MANAGEMENTHOST
304         params:
305           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, CephStorageHostnameResolveNetwork]}]}
306           DOMAIN: {get_param: CloudDomain}
307           PRIMARYHOST: {get_attr: [CephStorage, name]}
308           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
309           EXTERNALHOST:
310             list_join:
311             - '-'
312             - - {get_attr: [CephStorage, name]}
313               - external
314           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
315           INTERNAL_APIHOST:
316             list_join:
317             - '-'
318             - - {get_attr: [CephStorage, name]}
319               - internalapi
320           STORAGEIP: {get_attr: [StoragePort, ip_address]}
321           STORAGEHOST:
322             list_join:
323             - '-'
324             - - {get_attr: [CephStorage, name]}
325               - storage
326           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
327           STORAGE_MGMTHOST:
328             list_join:
329             - '-'
330             - - {get_attr: [CephStorage, name]}
331               - storagemgmt
332           TENANTIP: {get_attr: [TenantPort, ip_address]}
333           TENANTHOST:
334             list_join:
335             - '-'
336             - - {get_attr: [CephStorage, name]}
337               - tenant
338           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
339           MANAGEMENTHOST:
340             list_join:
341             - '-'
342             - - {get_attr: [CephStorage, name]}
343               - management
344   nova_server_resource:
345     description: Heat resource handle for the ceph storage server
346     value:
347       {get_resource: CephStorage}
348   external_ip_address:
349     description: IP address of the server in the external network
350     value: {get_attr: [ExternalPort, ip_address]}
351   internal_api_ip_address:
352     description: IP address of the server in the internal_api network
353     value: {get_attr: [InternalApiPort, ip_address]}
354   storage_ip_address:
355     description: IP address of the server in the storage network
356     value: {get_attr: [StoragePort, ip_address]}
357   storage_mgmt_ip_address:
358     description: IP address of the server in the storage_mgmt network
359     value: {get_attr: [StorageMgmtPort, ip_address]}
360   tenant_ip_address:
361     description: IP address of the server in the tenant network
362     value: {get_attr: [TenantPort, ip_address]}
363   management_ip_address:
364     description: IP address of the server in the management network
365     value: {get_attr: [ManagementPort, ip_address]}
366   config_identifier:
367     description: identifier which changes if the node configuration may need re-applying
368     value:
369       list_join:
370       - ','
371       - - {get_attr: [CephStorageDeployment, deploy_stdout]}
372         - {get_attr: [NodeTLSCAData, deploy_stdout]}
373         - {get_attr: [CephStorageExtraConfigPre, deploy_stdout]}
374         - {get_param: UpdateIdentifier}