b34d2c026a2a1bfbffee63e771b2bb0d4008fba6
[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 EC2 KeyPair 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   CloudDomain:
63     default: ''
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
75
76 resources:
77   CephStorage:
78     type: OS::Nova::Server
79     properties:
80       image: {get_param: Image}
81       image_update_policy: {get_param: ImageUpdatePolicy}
82       flavor: {get_param: Flavor}
83       key_name: {get_param: KeyName}
84       networks:
85         - network: ctlplane
86       user_data_format: SOFTWARE_CONFIG
87       user_data: {get_resource: UserData}
88       name: {get_param: Hostname}
89       metadata: {get_param: ServerMetadata}
90
91   # Combine the NodeAdminUserData and NodeUserData mime archives
92   UserData:
93     type: OS::Heat::MultipartMime
94     properties:
95       parts:
96       - config: {get_resource: NodeAdminUserData}
97         type: multipart
98       - config: {get_resource: NodeUserData}
99         type: multipart
100
101   # Creates the "heat-admin" user if configured via the environment
102   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
103   NodeAdminUserData:
104     type: OS::TripleO::NodeAdminUserData
105
106   # For optional operator additional userdata
107   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
108   NodeUserData:
109     type: OS::TripleO::NodeUserData
110
111   StoragePort:
112     type: OS::TripleO::CephStorage::Ports::StoragePort
113     properties:
114       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
115
116   StorageMgmtPort:
117     type: OS::TripleO::CephStorage::Ports::StorageMgmtPort
118     properties:
119       ControlPlaneIP: {get_attr: [CephStorage, networks, ctlplane, 0]}
120
121   NetworkConfig:
122     type: OS::TripleO::CephStorage::Net::SoftwareConfig
123     properties:
124       ControlPlaneIp: {get_attr: [CephStorage, networks, ctlplane, 0]}
125       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
126       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
127
128   NetIpMap:
129     type: OS::TripleO::Network::Ports::NetIpMap
130     properties:
131       ControlPlaneIp: {get_attr: [CephStorage, networks, ctlplane, 0]}
132       StorageIp: {get_attr: [StoragePort, ip_address]}
133       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
134
135   NetIpSubnetMap:
136     type: OS::TripleO::Network::Ports::NetIpSubnetMap
137     properties:
138       ControlPlaneIp: {get_attr: [CephStorage, networks, ctlplane, 0]}
139       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
140       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
141
142   NetworkDeployment:
143     type: OS::TripleO::SoftwareDeployment
144     properties:
145       config: {get_resource: NetworkConfig}
146       server: {get_resource: CephStorage}
147       actions: {get_param: NetworkDeploymentActions}
148
149   CephStorageDeployment:
150     type: OS::Heat::StructuredDeployment
151     depends_on: NetworkDeployment
152     properties:
153       config: {get_resource: CephStorageConfig}
154       server: {get_resource: CephStorage}
155       input_values:
156         ntp_servers: {get_param: NtpServer}
157         enable_package_install: {get_param: EnablePackageInstall}
158         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
159         ceph_cluster_network: {get_attr: [NetIpSubnetMap, net_ip_subnet_map, {get_param: [ServiceNetMap, CephClusterNetwork]}]}
160         ceph_public_network: {get_attr: [NetIpSubnetMap, net_ip_subnet_map, {get_param: [ServiceNetMap, CephPublicNetwork]}]}
161
162   CephStorageConfig:
163     type: OS::Heat::StructuredConfig
164     properties:
165       group: os-apply-config
166       config:
167         hiera:
168           hierarchy:
169             - '"%{::uuid}"'
170             - heat_config_%{::deploy_config_name}
171             - ceph_extraconfig
172             - extraconfig
173             - ceph_cluster # provided by CephClusterConfig
174             - ceph
175             - '"%{::osfamily}"'
176             - common
177           datafiles:
178             common:
179               raw_data: {get_file: hieradata/common.yaml}
180             ceph_extraconfig:
181               mapped_data: {get_param: CephStorageExtraConfig}
182             extraconfig:
183               mapped_data: {get_param: ExtraConfig}
184             ceph:
185               raw_data: {get_file: hieradata/ceph.yaml}
186               mapped_data:
187                 ntp::servers: {get_input: ntp_servers}
188                 tripleo::packages::enable_install: {get_input: enable_package_install}
189                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
190                 ceph::profile::params::cluster_network: {get_input: ceph_cluster_network}
191                 ceph::profile::params::public_network: {get_input: ceph_public_network}
192
193   # Resource for site-specific injection of root certificate
194   NodeTLSCAData:
195     depends_on: CephStorageDeployment
196     type: OS::TripleO::NodeTLSCAData
197     properties:
198       server: {get_resource: CephStorage}
199
200   # Hook for site-specific additional pre-deployment config, e.g extra hieradata
201   CephStorageExtraConfigPre:
202     depends_on: CephStorageDeployment
203     type: OS::TripleO::CephStorageExtraConfigPre
204     properties:
205         server: {get_resource: CephStorage}
206
207   # Hook for site-specific additional pre-deployment config,
208   # applying to all nodes, e.g node registration/unregistration
209   NodeExtraConfig:
210     depends_on: [CephStorageExtraConfigPre, NodeTLSCAData]
211     type: OS::TripleO::NodeExtraConfig
212     properties:
213         server: {get_resource: CephStorage}
214
215   UpdateConfig:
216     type: OS::TripleO::Tasks::PackageUpdate
217
218   UpdateDeployment:
219     type: OS::Heat::SoftwareDeployment
220     properties:
221       config: {get_resource: UpdateConfig}
222       server: {get_resource: CephStorage}
223       input_values:
224         update_identifier:
225           get_param: UpdateIdentifier
226
227 outputs:
228   hosts_entry:
229     value:
230       str_replace:
231         template: "IP HOST.DOMAIN HOST"
232         params:
233           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, CephStorageHostnameResolveNetwork]}]}
234           DOMAIN: {get_param: CloudDomain}
235           HOST: {get_attr: [CephStorage, name]}
236   nova_server_resource:
237     description: Heat resource handle for the ceph storage server
238     value:
239       {get_resource: CephStorage}
240   storage_ip_address:
241     description: IP address of the server in the storage network
242     value: {get_attr: [StoragePort, ip_address]}
243   storage_mgmt_ip_address:
244     description: IP address of the server in the storage_mgmt network
245     value: {get_attr: [StorageMgmtPort, ip_address]}
246   config_identifier:
247     description: identifier which changes if the node configuration may need re-applying
248     value:
249       list_join:
250       - ','
251       - - {get_attr: [CephStorageDeployment, deploy_stdout]}
252         - {get_attr: [NodeTLSCAData, deploy_stdout]}
253         - {get_attr: [CephStorageExtraConfigPre, deploy_stdout]}
254         - {get_param: UpdateIdentifier}