Merge "Enable TLS in loadbalancer if cert path is detected"
[apex-tripleo-heat-templates.git] / puppet / swift-storage.yaml
1 heat_template_version: 2015-04-30
2 description: 'OpenStack swift storage node configured by Puppet'
3 parameters:
4   Flavor:
5     description: Flavor for Swift storage nodes to request when deploying.
6     type: string
7     constraints:
8       - custom_constraint: nova.flavor
9   HashSuffix:
10     description: A random string to be used as a salt when hashing to determine mappings
11       in the ring.
12     hidden: true
13     type: string
14   Image:
15     default: overcloud-swift-storage
16     type: string
17   KeyName:
18     default: default
19     description: Name of an existing Nova key pair to enable SSH access to the instances
20     type: string
21   MountCheck:
22     default: 'false'
23     description: Value of mount_check in Swift account/container/object -server.conf
24     type: boolean
25   MinPartHours:
26     type: number
27     default: 1
28     description: The minimum time (in hours) before a partition in a ring can be moved following a rebalance.
29   PartPower:
30     default: 10
31     description: Partition Power to use when building Swift rings
32     type: number
33   Replicas:
34     type: number
35     default: 3
36     description: How many replicas to use in the swift rings.
37   SnmpdReadonlyUserName:
38     default: ro_snmp_user
39     description: The user name for SNMPd with readonly rights running on all Overcloud nodes
40     type: string
41   SnmpdReadonlyUserPassword:
42     description: The user password for SNMPd with readonly rights running on all Overcloud nodes
43     type: string
44     hidden: true
45   NtpServer:
46     default: ''
47     description: Comma-separated list of ntp servers
48     type: comma_delimited_list
49   EnablePackageInstall:
50     default: 'false'
51     description: Set to true to enable package installation via Puppet
52     type: boolean
53   UpdateIdentifier:
54     default: ''
55     type: string
56     description: >
57       Setting to a previously unused value during stack-update will trigger
58       package update on all nodes
59   ServiceNetMap:
60     default: {}
61     description: Mapping of service_name -> network name. Typically set
62                  via parameter_defaults in the resource registry.
63     type: json
64   Hostname:
65     type: string
66     default: '' # Defaults to Heat created hostname
67   ExtraConfig:
68     default: {}
69     description: |
70       Additional hiera configuration to inject into the cluster. Note
71       that ObjectStorageExtraConfig takes precedence over ExtraConfig.
72     type: json
73   ObjectStorageExtraConfig:
74     default: {}
75     description: |
76       Role specific additional hiera configuration to inject into the cluster.
77     type: json
78   NetworkDeploymentActions:
79     type: comma_delimited_list
80     description: >
81       Heat action when to apply network configuration changes
82     default: ['CREATE']
83   SoftwareConfigTransport:
84     default: POLL_SERVER_CFN
85     description: |
86       How the server should receive the metadata required for software configuration.
87     type: string
88     constraints:
89     - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
90   CloudDomain:
91     default: ''
92     type: string
93     description: >
94       The DNS domain used for the hosts. This should match the dhcp_domain
95       configured in the Undercloud neutron. Defaults to localdomain.
96   ServerMetadata:
97     default: {}
98     description: >
99       Extra properties or metadata passed to Nova for the created nodes in
100       the overcloud. It's accessible via the Nova metadata API.
101     type: json
102   SchedulerHints:
103     type: json
104     description: Optional scheduler hints to pass to nova
105     default: {}
106
107 resources:
108
109   SwiftStorage:
110     type: OS::Nova::Server
111     properties:
112       image: {get_param: Image}
113       flavor: {get_param: Flavor}
114       key_name: {get_param: KeyName}
115       networks:
116         - network: ctlplane
117       user_data_format: SOFTWARE_CONFIG
118       user_data: {get_resource: UserData}
119       name: {get_param: Hostname}
120       software_config_transport: {get_param: SoftwareConfigTransport}
121       metadata: {get_param: ServerMetadata}
122       scheduler_hints: {get_param: SchedulerHints}
123
124   # Combine the NodeAdminUserData and NodeUserData mime archives
125   UserData:
126     type: OS::Heat::MultipartMime
127     properties:
128       parts:
129       - config: {get_resource: NodeAdminUserData}
130         type: multipart
131       - config: {get_resource: NodeUserData}
132         type: multipart
133
134   # Creates the "heat-admin" user if configured via the environment
135   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
136   NodeAdminUserData:
137     type: OS::TripleO::NodeAdminUserData
138
139   # For optional operator additional userdata
140   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
141   NodeUserData:
142     type: OS::TripleO::NodeUserData
143
144   ExternalPort:
145     type: OS::TripleO::SwiftStorage::Ports::ExternalPort
146     properties:
147       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
148
149   InternalApiPort:
150     type: OS::TripleO::SwiftStorage::Ports::InternalApiPort
151     properties:
152       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
153
154   StoragePort:
155     type: OS::TripleO::SwiftStorage::Ports::StoragePort
156     properties:
157       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
158
159   StorageMgmtPort:
160     type: OS::TripleO::SwiftStorage::Ports::StorageMgmtPort
161     properties:
162       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
163
164   TenantPort:
165     type: OS::TripleO::SwiftStorage::Ports::TenantPort
166     properties:
167       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
168
169   ManagementPort:
170     type: OS::TripleO::SwiftStorage::Ports::ManagementPort
171     properties:
172       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
173
174   NetworkConfig:
175     type: OS::TripleO::ObjectStorage::Net::SoftwareConfig
176     properties:
177       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
178       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
179       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
180       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
181       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
182       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
183       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
184
185   NetIpMap:
186     type: OS::TripleO::Network::Ports::NetIpMap
187     properties:
188       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
189       ExternalIp: {get_attr: [ExternalPort, ip_address]}
190       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
191       StorageIp: {get_attr: [StoragePort, ip_address]}
192       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
193       TenantIp: {get_attr: [TenantPort, ip_address]}
194       ManagementIp: {get_attr: [ManagementPort, ip_address]}
195
196   NetworkDeployment:
197     type: OS::TripleO::SoftwareDeployment
198     properties:
199       config: {get_resource: NetworkConfig}
200       server: {get_resource: SwiftStorage}
201       actions: {get_param: NetworkDeploymentActions}
202
203   SwiftStorageHieraConfig:
204     type: OS::Heat::StructuredConfig
205     properties:
206       group: os-apply-config
207       config:
208         hiera:
209           hierarchy:
210             - '"%{::uuid}"'
211             - heat_config_%{::deploy_config_name}
212             - object_extraconfig
213             - extraconfig
214             - object
215             - swift_devices_and_proxy # provided by SwiftDevicesAndProxyConfig
216             - all_nodes # provided by allNodesConfig
217             - '"%{::osfamily}"'
218             - common
219           datafiles:
220             common:
221               raw_data: {get_file: hieradata/common.yaml}
222             object_extraconfig:
223               mapped_data: {get_param: ObjectStorageExtraConfig}
224             extraconfig:
225               mapped_data: {get_param: ExtraConfig}
226             object:
227               raw_data: {get_file: hieradata/object.yaml}
228               mapped_data: # data supplied directly to this deployment configuration, etc
229                 swift::swift_hash_suffix: { get_input: swift_hash_suffix }
230                 tripleo::ringbuilder::part_power: { get_input: swift_part_power }
231                 tripleo::ringbuilder::replicas: {get_input: swift_replicas }
232                 # Swift
233                 swift::storage::all::storage_local_net_ip: {get_input: swift_management_network}
234                 swift_mount_check: {get_input: swift_mount_check }
235                 tripleo::ringbuilder::min_part_hours: { get_input: swift_min_part_hours }
236                 ntp::servers: {get_input: ntp_servers}
237                 # NOTE(dprince): build_ring support is currently not wired in.
238                 # See: https://review.openstack.org/#/c/109225/
239                 tripleo::ringbuilder::build_ring: True
240                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
241                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
242                 tripleo::packages::enable_install: {get_input: enable_package_install}
243                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
244
245
246   SwiftStorageHieraDeploy:
247     type: OS::Heat::StructuredDeployment
248     depends_on: NetworkDeployment
249     properties:
250       server: {get_resource: SwiftStorage}
251       config: {get_resource: SwiftStorageHieraConfig}
252       input_values:
253         local_ip: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
254         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
255         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
256         swift_hash_suffix: {get_param: HashSuffix}
257         swift_mount_check: {get_param: MountCheck}
258         swift_min_part_hours: {get_param: MinPartHours}
259         swift_part_power: {get_param: PartPower}
260         swift_replicas: { get_param: Replicas}
261         ntp_servers: {get_param: NtpServer}
262         enable_package_install: {get_param: EnablePackageInstall}
263         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
264         swift_management_network: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
265
266   # Resource for site-specific injection of root certificate
267   NodeTLSCAData:
268     depends_on: SwiftStorageHieraDeploy
269     type: OS::TripleO::NodeTLSCAData
270     properties:
271       server: {get_resource: SwiftStorage}
272
273   # Hook for site-specific additional pre-deployment config,
274   # applying to all nodes, e.g node registration/unregistration
275   NodeExtraConfig:
276     depends_on: NodeTLSCAData
277     type: OS::TripleO::NodeExtraConfig
278     properties:
279         server: {get_resource: SwiftStorage}
280
281   UpdateConfig:
282     type: OS::TripleO::Tasks::PackageUpdate
283
284   UpdateDeployment:
285     type: OS::Heat::SoftwareDeployment
286     properties:
287       config: {get_resource: UpdateConfig}
288       server: {get_resource: SwiftStorage}
289       input_values:
290         update_identifier:
291           get_param: UpdateIdentifier
292
293 outputs:
294   hosts_entry:
295     value:
296       str_replace:
297         template: "IP HOST.DOMAIN HOST"
298         params:
299           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ObjectStorageHostnameResolveNetwork]}]}
300           DOMAIN: {get_param: CloudDomain}
301           HOST: {get_attr: [SwiftStorage, name]}
302   nova_server_resource:
303     description: Heat resource handle for the swift storage server
304     value:
305       {get_resource: SwiftStorage}
306   swift_device:
307     description: Swift device formatted for swift-ring-builder
308     value:
309       str_replace:
310         template: 'r1z1-IP:%PORT%/d1'
311         params:
312           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
313   external_ip_address:
314     description: IP address of the server in the external network
315     value: {get_attr: [ExternalPort, ip_address]}
316   internal_api_ip_address:
317     description: IP address of the server in the internal_api network
318     value: {get_attr: [InternalApiPort, ip_address]}
319   storage_ip_address:
320     description: IP address of the server in the storage network
321     value: {get_attr: [StoragePort, ip_address]}
322   storage_mgmt_ip_address:
323     description: IP address of the server in the storage_mgmt network
324     value: {get_attr: [StorageMgmtPort, ip_address]}
325   tenant_ip_address:
326     description: IP address of the server in the tenant network
327     value: {get_attr: [TenantPort, ip_address]}
328   management_ip_address:
329     description: IP address of the server in the management network
330     value: {get_attr: [ManagementPort, ip_address]}
331   config_identifier:
332     description: identifier which changes if the node configuration may need re-applying
333     value:
334       list_join:
335         - ','
336         - - {get_attr: [SwiftStorageHieraDeploy, deploy_stdout]}
337           - {get_attr: [NodeTLSCAData, deploy_stdout]}
338           - {get_param: UpdateIdentifier}