Merge "Add ExtraConfig to cinder storage role"
[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   ExtraConfig:
51     default: {}
52     description: |
53       Additional hiera configuration to inject into the cluster. Note
54       that CephStorageExtraConfig takes precedence over ExtraConfig.
55     type: json
56   CephStorageExtraConfig:
57     default: {}
58     description: |
59       Role specific additional hiera configuration to inject into the cluster.
60     type: json
61   NetworkDeploymentActions:
62     type: comma_delimited_list
63     description: >
64       Heat action when to apply network configuration changes
65     default: ['CREATE']
66   SoftwareConfigTransport:
67     default: POLL_SERVER_CFN
68     description: |
69       How the server should receive the metadata required for software configuration.
70     type: string
71     constraints:
72     - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
73   CloudDomain:
74     default: ''
75     type: string
76     description: >
77       The DNS domain used for the hosts. This should match the dhcp_domain
78       configured in the Undercloud neutron. Defaults to localdomain.
79   ServerMetadata:
80     default: {}
81     description: >
82       Extra properties or metadata passed to Nova for the created nodes in
83       the overcloud. It's accessible via the Nova metadata API.
84     type: json
85   SchedulerHints:
86     type: json
87     description: Optional scheduler hints to pass to nova
88     default: {}
89
90 resources:
91   CephStorage:
92     type: OS::Nova::Server
93     properties:
94       image: {get_param: Image}
95       image_update_policy: {get_param: ImageUpdatePolicy}
96       flavor: {get_param: Flavor}
97       key_name: {get_param: KeyName}
98       networks:
99         - network: ctlplane
100       user_data_format: SOFTWARE_CONFIG
101       user_data: {get_resource: UserData}
102       name: {get_param: Hostname}
103       software_config_transport: {get_param: SoftwareConfigTransport}
104       metadata: {get_param: ServerMetadata}
105       scheduler_hints: {get_param: SchedulerHints}
106
107   # Combine the NodeAdminUserData and NodeUserData mime archives
108   UserData:
109     type: OS::Heat::MultipartMime
110     properties:
111       parts:
112       - config: {get_resource: NodeAdminUserData}
113         type: multipart
114       - config: {get_resource: NodeUserData}
115         type: multipart
116
117   # Creates the "heat-admin" user if configured via the environment
118   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
119   NodeAdminUserData:
120     type: OS::TripleO::NodeAdminUserData
121
122   # For optional operator additional userdata
123   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
124   NodeUserData:
125     type: OS::TripleO::NodeUserData
126
127   ExternalPort:
128     type: OS::TripleO::CephStorage::Ports::ExternalPort
129     properties:
130       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
131
132   InternalApiPort:
133     type: OS::TripleO::CephStorage::Ports::InternalApiPort
134     properties:
135       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
136
137   StoragePort:
138     type: OS::TripleO::CephStorage::Ports::StoragePort
139     properties:
140       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
141
142   StorageMgmtPort:
143     type: OS::TripleO::CephStorage::Ports::StorageMgmtPort
144     properties:
145       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
146
147   TenantPort:
148     type: OS::TripleO::CephStorage::Ports::TenantPort
149     properties:
150       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
151
152   ManagementPort:
153     type: OS::TripleO::CephStorage::Ports::ManagementPort
154     properties:
155       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
156
157   NetworkConfig:
158     type: OS::TripleO::CephStorage::Net::SoftwareConfig
159     properties:
160       ControlPlaneIp: {get_attr: [CephStorage, networks, ctlplane, 0]}
161       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
162       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
163       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
164       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
165       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
166       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
167
168   NetIpMap:
169     type: OS::TripleO::Network::Ports::NetIpMap
170     properties:
171       ControlPlaneIp: {get_attr: [CephStorage, networks, ctlplane, 0]}
172       ExternalIp: {get_attr: [ExternalPort, ip_address]}
173       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
174       StorageIp: {get_attr: [StoragePort, ip_address]}
175       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
176       TenantIp: {get_attr: [TenantPort, ip_address]}
177       ManagementIp: {get_attr: [ManagementPort, ip_address]}
178
179   NetIpSubnetMap:
180     type: OS::TripleO::Network::Ports::NetIpSubnetMap
181     properties:
182       ControlPlaneIp: {get_attr: [CephStorage, networks, ctlplane, 0]}
183       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
184       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
185       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
186       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
187       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
188       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
189
190   NetworkDeployment:
191     type: OS::TripleO::SoftwareDeployment
192     properties:
193       config: {get_resource: NetworkConfig}
194       server: {get_resource: CephStorage}
195       actions: {get_param: NetworkDeploymentActions}
196
197   CephStorageDeployment:
198     type: OS::Heat::StructuredDeployment
199     depends_on: NetworkDeployment
200     properties:
201       config: {get_resource: CephStorageConfig}
202       server: {get_resource: CephStorage}
203       input_values:
204         ntp_servers: {get_param: NtpServer}
205         timezone: {get_param: TimeZone}
206         enable_package_install: {get_param: EnablePackageInstall}
207         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
208         ceph_cluster_network: {get_attr: [NetIpSubnetMap, net_ip_subnet_map, {get_param: [ServiceNetMap, CephClusterNetwork]}]}
209         ceph_public_network: {get_attr: [NetIpSubnetMap, net_ip_subnet_map, {get_param: [ServiceNetMap, CephPublicNetwork]}]}
210
211   CephStorageConfig:
212     type: OS::Heat::StructuredConfig
213     properties:
214       group: os-apply-config
215       config:
216         hiera:
217           hierarchy:
218             - '"%{::uuid}"'
219             - heat_config_%{::deploy_config_name}
220             - ceph_extraconfig
221             - extraconfig
222             - ceph_cluster # provided by CephClusterConfig
223             - ceph
224             - '"%{::osfamily}"'
225             - common
226           datafiles:
227             common:
228               raw_data: {get_file: hieradata/common.yaml}
229             ceph_extraconfig:
230               mapped_data: {get_param: CephStorageExtraConfig}
231             extraconfig:
232               mapped_data: {get_param: ExtraConfig}
233             ceph:
234               raw_data: {get_file: hieradata/ceph.yaml}
235               mapped_data:
236                 ntp::servers: {get_input: ntp_servers}
237                 timezone::timezone: {get_input: timezone}
238                 tripleo::packages::enable_install: {get_input: enable_package_install}
239                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
240                 ceph::profile::params::cluster_network: {get_input: ceph_cluster_network}
241                 ceph::profile::params::public_network: {get_input: ceph_public_network}
242
243   # Resource for site-specific injection of root certificate
244   NodeTLSCAData:
245     depends_on: CephStorageDeployment
246     type: OS::TripleO::NodeTLSCAData
247     properties:
248       server: {get_resource: CephStorage}
249
250   # Hook for site-specific additional pre-deployment config, e.g extra hieradata
251   CephStorageExtraConfigPre:
252     depends_on: CephStorageDeployment
253     type: OS::TripleO::CephStorageExtraConfigPre
254     properties:
255         server: {get_resource: CephStorage}
256
257   # Hook for site-specific additional pre-deployment config,
258   # applying to all nodes, e.g node registration/unregistration
259   NodeExtraConfig:
260     depends_on: [CephStorageExtraConfigPre, NodeTLSCAData]
261     type: OS::TripleO::NodeExtraConfig
262     properties:
263         server: {get_resource: CephStorage}
264
265   UpdateConfig:
266     type: OS::TripleO::Tasks::PackageUpdate
267
268   UpdateDeployment:
269     type: OS::Heat::SoftwareDeployment
270     properties:
271       config: {get_resource: UpdateConfig}
272       server: {get_resource: CephStorage}
273       input_values:
274         update_identifier:
275           get_param: UpdateIdentifier
276
277 outputs:
278   hosts_entry:
279     value:
280       str_replace:
281         template: "IP HOST.DOMAIN HOST"
282         params:
283           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, CephStorageHostnameResolveNetwork]}]}
284           DOMAIN: {get_param: CloudDomain}
285           HOST: {get_attr: [CephStorage, name]}
286   nova_server_resource:
287     description: Heat resource handle for the ceph storage server
288     value:
289       {get_resource: CephStorage}
290   external_ip_address:
291     description: IP address of the server in the external network
292     value: {get_attr: [ExternalPort, ip_address]}
293   internal_api_ip_address:
294     description: IP address of the server in the internal_api network
295     value: {get_attr: [InternalApiPort, ip_address]}
296   storage_ip_address:
297     description: IP address of the server in the storage network
298     value: {get_attr: [StoragePort, ip_address]}
299   storage_mgmt_ip_address:
300     description: IP address of the server in the storage_mgmt network
301     value: {get_attr: [StorageMgmtPort, ip_address]}
302   tenant_ip_address:
303     description: IP address of the server in the tenant network
304     value: {get_attr: [TenantPort, ip_address]}
305   management_ip_address:
306     description: IP address of the server in the management network
307     value: {get_attr: [ManagementPort, ip_address]}
308   config_identifier:
309     description: identifier which changes if the node configuration may need re-applying
310     value:
311       list_join:
312       - ','
313       - - {get_attr: [CephStorageDeployment, deploy_stdout]}
314         - {get_attr: [NodeTLSCAData, deploy_stdout]}
315         - {get_attr: [CephStorageExtraConfigPre, deploy_stdout]}
316         - {get_param: UpdateIdentifier}