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