Merge "Add Ceph cluster health validation on upgrade"
[apex-tripleo-heat-templates.git] / puppet / swift-storage.yaml
1 heat_template_version: 2016-10-14
2 description: 'OpenStack swift storage node configured by Puppet'
3 parameters:
4   OvercloudSwiftStorageFlavor:
5     description: Flavor for Swift storage nodes to request when deploying.
6     default: baremetal
7     type: string
8     constraints:
9       - custom_constraint: nova.flavor
10   SwiftStorageImage:
11     default: overcloud-full
12     type: string
13     constraints:
14       - custom_constraint: glance.image
15   KeyName:
16     default: default
17     description: Name of an existing Nova key pair to enable SSH access to the instances
18     type: string
19   UpdateIdentifier:
20     default: ''
21     type: string
22     description: >
23       Setting to a previously unused value during stack-update will trigger
24       package update on all nodes
25   ServiceNetMap:
26     default: {}
27     description: Mapping of service_name -> network name. Typically set
28                  via parameter_defaults in the resource registry.
29     type: json
30   Hostname:
31     type: string
32     default: '' # Defaults to Heat created hostname
33   HostnameMap:
34     type: json
35     default: {}
36     description: Optional mapping to override hostnames
37   ExtraConfig:
38     default: {}
39     description: |
40       Additional hiera configuration to inject into the cluster. Note
41       that ObjectStorageExtraConfig takes precedence over ExtraConfig.
42     type: json
43   ObjectStorageExtraConfig:
44     default: {}
45     description: |
46       Role specific additional hiera configuration to inject into the cluster.
47     type: json
48   SwiftStorageIPs:
49     default: {}
50     type: json
51   NetworkDeploymentActions:
52     type: comma_delimited_list
53     description: >
54       Heat action when to apply network configuration changes
55     default: ['CREATE']
56   SoftwareConfigTransport:
57     default: POLL_SERVER_CFN
58     description: |
59       How the server should receive the metadata required for software configuration.
60     type: string
61     constraints:
62     - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
63   CloudDomain:
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   ObjectStorageSchedulerHints:
75     type: json
76     description: Optional scheduler hints to pass to nova
77     default: {}
78   NodeIndex:
79     type: number
80     default: 0
81   ServiceConfigSettings:
82     type: json
83     default: {}
84   ServiceNames:
85     type: comma_delimited_list
86     default: []
87   MonitoringSubscriptions:
88     type: comma_delimited_list
89     default: []
90   ConfigCommand:
91     type: string
92     description: Command which will be run whenever configuration data changes
93     default: os-refresh-config --timeout 14400
94
95 resources:
96
97   SwiftStorage:
98     type: OS::Nova::Server
99     metadata:
100       os-collect-config:
101         command: {get_param: ConfigCommand}
102     properties:
103       image: {get_param: SwiftStorageImage}
104       flavor: {get_param: OvercloudSwiftStorageFlavor}
105       key_name: {get_param: KeyName}
106       networks:
107         - network: ctlplane
108       user_data_format: SOFTWARE_CONFIG
109       user_data: {get_resource: UserData}
110       name:
111         str_replace:
112             template: {get_param: Hostname}
113             params: {get_param: HostnameMap}
114       software_config_transport: {get_param: SoftwareConfigTransport}
115       metadata: {get_param: ServerMetadata}
116       scheduler_hints: {get_param: ObjectStorageSchedulerHints}
117
118   # Combine the NodeAdminUserData and NodeUserData mime archives
119   UserData:
120     type: OS::Heat::MultipartMime
121     properties:
122       parts:
123       - config: {get_resource: NodeAdminUserData}
124         type: multipart
125       - config: {get_resource: NodeUserData}
126         type: multipart
127
128   # Creates the "heat-admin" user if configured via the environment
129   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
130   NodeAdminUserData:
131     type: OS::TripleO::NodeAdminUserData
132
133   # For optional operator additional userdata
134   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
135   NodeUserData:
136     type: OS::TripleO::NodeUserData
137
138   ExternalPort:
139     type: OS::TripleO::SwiftStorage::Ports::ExternalPort
140     properties:
141       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
142       IPPool: {get_param: SwiftStorageIPs}
143       NodeIndex: {get_param: NodeIndex}
144
145   InternalApiPort:
146     type: OS::TripleO::SwiftStorage::Ports::InternalApiPort
147     properties:
148       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
149       IPPool: {get_param: SwiftStorageIPs}
150       NodeIndex: {get_param: NodeIndex}
151
152   StoragePort:
153     type: OS::TripleO::SwiftStorage::Ports::StoragePort
154     properties:
155       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
156       IPPool: {get_param: SwiftStorageIPs}
157       NodeIndex: {get_param: NodeIndex}
158
159   StorageMgmtPort:
160     type: OS::TripleO::SwiftStorage::Ports::StorageMgmtPort
161     properties:
162       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
163       IPPool: {get_param: SwiftStorageIPs}
164       NodeIndex: {get_param: NodeIndex}
165
166   TenantPort:
167     type: OS::TripleO::SwiftStorage::Ports::TenantPort
168     properties:
169       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
170       IPPool: {get_param: SwiftStorageIPs}
171       NodeIndex: {get_param: NodeIndex}
172
173   ManagementPort:
174     type: OS::TripleO::SwiftStorage::Ports::ManagementPort
175     properties:
176       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
177       IPPool: {get_param: SwiftStorageIPs}
178       NodeIndex: {get_param: NodeIndex}
179
180   NetworkConfig:
181     type: OS::TripleO::ObjectStorage::Net::SoftwareConfig
182     properties:
183       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
184       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
185       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
186       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
187       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
188       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
189       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
190
191   NetIpMap:
192     type: OS::TripleO::Network::Ports::NetIpMap
193     properties:
194       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
195       ExternalIp: {get_attr: [ExternalPort, ip_address]}
196       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
197       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
198       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
199       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
200       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
201       StorageIp: {get_attr: [StoragePort, ip_address]}
202       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
203       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
204       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
205       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
206       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
207       TenantIp: {get_attr: [TenantPort, ip_address]}
208       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
209       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
210       ManagementIp: {get_attr: [ManagementPort, ip_address]}
211       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
212       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
213
214   NetworkDeployment:
215     type: OS::TripleO::SoftwareDeployment
216     properties:
217       name: NetworkDeployment
218       config: {get_resource: NetworkConfig}
219       server: {get_resource: SwiftStorage}
220       actions: {get_param: NetworkDeploymentActions}
221
222   SwiftStorageHieraConfig:
223     type: OS::Heat::StructuredConfig
224     properties:
225       group: os-apply-config
226       config:
227         hiera:
228           hierarchy:
229             - '"%{::uuid}"'
230             - heat_config_%{::deploy_config_name}
231             - object_extraconfig
232             - extraconfig
233             - service_names
234             - service_configs
235             - object
236             - bootstrap_node # provided by allNodesConfig
237             - all_nodes # provided by allNodesConfig
238             - vip_data # provided by allNodesConfig
239             - '"%{::osfamily}"'
240           merge_behavior: deeper
241           datafiles:
242             service_names:
243               mapped_data:
244                 service_names: {get_param: ServiceNames}
245                 sensu::subscriptions: {get_param: MonitoringSubscriptions}
246             service_configs:
247               mapped_data:
248                 map_replace:
249                   - {get_param: ServiceConfigSettings}
250                   - values: {get_attr: [NetIpMap, net_ip_map]}
251             object_extraconfig:
252               mapped_data: {get_param: ObjectStorageExtraConfig}
253             extraconfig:
254               mapped_data: {get_param: ExtraConfig}
255             object:
256               mapped_data: # data supplied directly to this deployment configuration, etc
257                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
258
259
260   SwiftStorageHieraDeploy:
261     type: OS::Heat::StructuredDeployment
262     depends_on: NetworkDeployment
263     properties:
264       name: SwiftStorageHieraDeploy
265       server: {get_resource: SwiftStorage}
266       config: {get_resource: SwiftStorageHieraConfig}
267       input_values:
268         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
269
270   # Resource for site-specific injection of root certificate
271   NodeTLSCAData:
272     depends_on: SwiftStorageHieraDeploy
273     type: OS::TripleO::NodeTLSCAData
274     properties:
275       server: {get_resource: SwiftStorage}
276
277   # Hook for site-specific additional pre-deployment config,
278   # applying to all nodes, e.g node registration/unregistration
279   NodeExtraConfig:
280     depends_on: NodeTLSCAData
281     type: OS::TripleO::NodeExtraConfig
282     properties:
283         server: {get_resource: SwiftStorage}
284
285   UpdateConfig:
286     type: OS::TripleO::Tasks::PackageUpdate
287
288   UpdateDeployment:
289     type: OS::Heat::SoftwareDeployment
290     properties:
291       config: {get_resource: UpdateConfig}
292       server: {get_resource: SwiftStorage}
293       input_values:
294         update_identifier:
295           get_param: UpdateIdentifier
296
297 outputs:
298   ip_address:
299     description: IP address of the server in the ctlplane network
300     value: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
301   hostname:
302     description: Hostname of the server
303     value: {get_attr: [SwiftStorage, name]}
304   hosts_entry:
305     value:
306       str_replace:
307         template: |
308           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
309           EXTERNALIP EXTERNALHOST.DOMAIN EXTERNALHOST
310           INTERNAL_APIIP INTERNAL_APIHOST.DOMAIN INTERNAL_APIHOST
311           STORAGEIP STORAGEHOST.DOMAIN STORAGEHOST
312           STORAGE_MGMTIP STORAGE_MGMTHOST.DOMAIN STORAGE_MGMTHOST
313           TENANTIP TENANTHOST.DOMAIN TENANTHOST
314           MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
315         params:
316           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ObjectStorageHostnameResolveNetwork]}]}
317           DOMAIN: {get_param: CloudDomain}
318           PRIMARYHOST: {get_attr: [SwiftStorage, name]}
319           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
320           EXTERNALHOST:
321             list_join:
322             - '.'
323             - - {get_attr: [SwiftStorage, name]}
324               - external
325           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
326           INTERNAL_APIHOST:
327             list_join:
328             - '.'
329             - - {get_attr: [SwiftStorage, name]}
330               - internalapi
331           STORAGEIP: {get_attr: [StoragePort, ip_address]}
332           STORAGEHOST:
333             list_join:
334             - '.'
335             - - {get_attr: [SwiftStorage, name]}
336               - storage
337           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
338           STORAGE_MGMTHOST:
339             list_join:
340             - '.'
341             - - {get_attr: [SwiftStorage, name]}
342               - storagemgmt
343           TENANTIP: {get_attr: [TenantPort, ip_address]}
344           TENANTHOST:
345             list_join:
346             - '.'
347             - - {get_attr: [SwiftStorage, name]}
348               - tenant
349           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
350           MANAGEMENTHOST:
351             list_join:
352             - '.'
353             - - {get_attr: [SwiftStorage, name]}
354               - management
355   nova_server_resource:
356     description: Heat resource handle for the swift storage server
357     value:
358       {get_resource: SwiftStorage}
359   external_ip_address:
360     description: IP address of the server in the external network
361     value: {get_attr: [ExternalPort, ip_address]}
362   internal_api_ip_address:
363     description: IP address of the server in the internal_api network
364     value: {get_attr: [InternalApiPort, ip_address]}
365   storage_ip_address:
366     description: IP address of the server in the storage network
367     value: {get_attr: [StoragePort, ip_address]}
368   storage_mgmt_ip_address:
369     description: IP address of the server in the storage_mgmt network
370     value: {get_attr: [StorageMgmtPort, ip_address]}
371   tenant_ip_address:
372     description: IP address of the server in the tenant network
373     value: {get_attr: [TenantPort, ip_address]}
374   management_ip_address:
375     description: IP address of the server in the management network
376     value: {get_attr: [ManagementPort, ip_address]}