Merge "Set the name property for all deployment resources"
[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   TimeZone:
65     default: 'UTC'
66     description: The timezone to be set on Ceph nodes.
67     type: string
68   Hostname:
69     type: string
70     default: '' # Defaults to Heat created hostname
71   ExtraConfig:
72     default: {}
73     description: |
74       Additional hiera configuration to inject into the cluster. Note
75       that ObjectStorageExtraConfig takes precedence over ExtraConfig.
76     type: json
77   ObjectStorageExtraConfig:
78     default: {}
79     description: |
80       Role specific additional hiera configuration to inject into the cluster.
81     type: json
82   NetworkDeploymentActions:
83     type: comma_delimited_list
84     description: >
85       Heat action when to apply network configuration changes
86     default: ['CREATE']
87   SoftwareConfigTransport:
88     default: POLL_SERVER_CFN
89     description: |
90       How the server should receive the metadata required for software configuration.
91     type: string
92     constraints:
93     - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
94   CloudDomain:
95     default: ''
96     type: string
97     description: >
98       The DNS domain used for the hosts. This should match the dhcp_domain
99       configured in the Undercloud neutron. Defaults to localdomain.
100   ServerMetadata:
101     default: {}
102     description: >
103       Extra properties or metadata passed to Nova for the created nodes in
104       the overcloud. It's accessible via the Nova metadata API.
105     type: json
106   SchedulerHints:
107     type: json
108     description: Optional scheduler hints to pass to nova
109     default: {}
110
111 resources:
112
113   SwiftStorage:
114     type: OS::Nova::Server
115     properties:
116       image: {get_param: Image}
117       flavor: {get_param: Flavor}
118       key_name: {get_param: KeyName}
119       networks:
120         - network: ctlplane
121       user_data_format: SOFTWARE_CONFIG
122       user_data: {get_resource: UserData}
123       name: {get_param: Hostname}
124       software_config_transport: {get_param: SoftwareConfigTransport}
125       metadata: {get_param: ServerMetadata}
126       scheduler_hints: {get_param: SchedulerHints}
127
128   # Combine the NodeAdminUserData and NodeUserData mime archives
129   UserData:
130     type: OS::Heat::MultipartMime
131     properties:
132       parts:
133       - config: {get_resource: NodeAdminUserData}
134         type: multipart
135       - config: {get_resource: NodeUserData}
136         type: multipart
137
138   # Creates the "heat-admin" user if configured via the environment
139   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
140   NodeAdminUserData:
141     type: OS::TripleO::NodeAdminUserData
142
143   # For optional operator additional userdata
144   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
145   NodeUserData:
146     type: OS::TripleO::NodeUserData
147
148   ExternalPort:
149     type: OS::TripleO::SwiftStorage::Ports::ExternalPort
150     properties:
151       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
152
153   InternalApiPort:
154     type: OS::TripleO::SwiftStorage::Ports::InternalApiPort
155     properties:
156       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
157
158   StoragePort:
159     type: OS::TripleO::SwiftStorage::Ports::StoragePort
160     properties:
161       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
162
163   StorageMgmtPort:
164     type: OS::TripleO::SwiftStorage::Ports::StorageMgmtPort
165     properties:
166       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
167
168   TenantPort:
169     type: OS::TripleO::SwiftStorage::Ports::TenantPort
170     properties:
171       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
172
173   ManagementPort:
174     type: OS::TripleO::SwiftStorage::Ports::ManagementPort
175     properties:
176       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
177
178   NetworkConfig:
179     type: OS::TripleO::ObjectStorage::Net::SoftwareConfig
180     properties:
181       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
182       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
183       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
184       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
185       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
186       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
187       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
188
189   NetIpMap:
190     type: OS::TripleO::Network::Ports::NetIpMap
191     properties:
192       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
193       ExternalIp: {get_attr: [ExternalPort, ip_address]}
194       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
195       StorageIp: {get_attr: [StoragePort, ip_address]}
196       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
197       TenantIp: {get_attr: [TenantPort, ip_address]}
198       ManagementIp: {get_attr: [ManagementPort, ip_address]}
199
200   NetworkDeployment:
201     type: OS::TripleO::SoftwareDeployment
202     properties:
203       name: NetworkDeployment
204       config: {get_resource: NetworkConfig}
205       server: {get_resource: SwiftStorage}
206       actions: {get_param: NetworkDeploymentActions}
207
208   SwiftStorageHieraConfig:
209     type: OS::Heat::StructuredConfig
210     properties:
211       group: os-apply-config
212       config:
213         hiera:
214           hierarchy:
215             - '"%{::uuid}"'
216             - heat_config_%{::deploy_config_name}
217             - object_extraconfig
218             - extraconfig
219             - object
220             - swift_devices_and_proxy # provided by SwiftDevicesAndProxyConfig
221             - all_nodes # provided by allNodesConfig
222             - '"%{::osfamily}"'
223             - common
224           datafiles:
225             common:
226               raw_data: {get_file: hieradata/common.yaml}
227             object_extraconfig:
228               mapped_data: {get_param: ObjectStorageExtraConfig}
229             extraconfig:
230               mapped_data: {get_param: ExtraConfig}
231             object:
232               raw_data: {get_file: hieradata/object.yaml}
233               mapped_data: # data supplied directly to this deployment configuration, etc
234                 swift::swift_hash_suffix: { get_input: swift_hash_suffix }
235                 tripleo::ringbuilder::part_power: { get_input: swift_part_power }
236                 tripleo::ringbuilder::replicas: {get_input: swift_replicas }
237                 # Swift
238                 swift::storage::all::storage_local_net_ip: {get_input: swift_management_network}
239                 swift_mount_check: {get_input: swift_mount_check }
240                 tripleo::ringbuilder::min_part_hours: { get_input: swift_min_part_hours }
241                 ntp::servers: {get_input: ntp_servers}
242                 timezone::timezone: {get_input: timezone}
243                 # NOTE(dprince): build_ring support is currently not wired in.
244                 # See: https://review.openstack.org/#/c/109225/
245                 tripleo::ringbuilder::build_ring: True
246                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
247                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
248                 tripleo::packages::enable_install: {get_input: enable_package_install}
249                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
250
251
252   SwiftStorageHieraDeploy:
253     type: OS::Heat::StructuredDeployment
254     depends_on: NetworkDeployment
255     properties:
256       name: SwiftStorageHieraDeploy
257       server: {get_resource: SwiftStorage}
258       config: {get_resource: SwiftStorageHieraConfig}
259       input_values:
260         local_ip: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
261         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
262         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
263         swift_hash_suffix: {get_param: HashSuffix}
264         swift_mount_check: {get_param: MountCheck}
265         swift_min_part_hours: {get_param: MinPartHours}
266         swift_part_power: {get_param: PartPower}
267         swift_replicas: { get_param: Replicas}
268         ntp_servers: {get_param: NtpServer}
269         timezone: {get_param: TimeZone}
270         enable_package_install: {get_param: EnablePackageInstall}
271         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
272         swift_management_network: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
273
274   # Resource for site-specific injection of root certificate
275   NodeTLSCAData:
276     depends_on: SwiftStorageHieraDeploy
277     type: OS::TripleO::NodeTLSCAData
278     properties:
279       server: {get_resource: SwiftStorage}
280
281   # Hook for site-specific additional pre-deployment config,
282   # applying to all nodes, e.g node registration/unregistration
283   NodeExtraConfig:
284     depends_on: NodeTLSCAData
285     type: OS::TripleO::NodeExtraConfig
286     properties:
287         server: {get_resource: SwiftStorage}
288
289   UpdateConfig:
290     type: OS::TripleO::Tasks::PackageUpdate
291
292   UpdateDeployment:
293     type: OS::Heat::SoftwareDeployment
294     properties:
295       config: {get_resource: UpdateConfig}
296       server: {get_resource: SwiftStorage}
297       input_values:
298         update_identifier:
299           get_param: UpdateIdentifier
300
301 outputs:
302   hosts_entry:
303     value:
304       str_replace:
305         template: "IP HOST.DOMAIN HOST"
306         params:
307           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ObjectStorageHostnameResolveNetwork]}]}
308           DOMAIN: {get_param: CloudDomain}
309           HOST: {get_attr: [SwiftStorage, name]}
310   nova_server_resource:
311     description: Heat resource handle for the swift storage server
312     value:
313       {get_resource: SwiftStorage}
314   swift_device:
315     description: Swift device formatted for swift-ring-builder
316     value:
317       str_replace:
318         template: 'r1z1-IP:%PORT%/d1'
319         params:
320           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
321   external_ip_address:
322     description: IP address of the server in the external network
323     value: {get_attr: [ExternalPort, ip_address]}
324   internal_api_ip_address:
325     description: IP address of the server in the internal_api network
326     value: {get_attr: [InternalApiPort, ip_address]}
327   storage_ip_address:
328     description: IP address of the server in the storage network
329     value: {get_attr: [StoragePort, ip_address]}
330   storage_mgmt_ip_address:
331     description: IP address of the server in the storage_mgmt network
332     value: {get_attr: [StorageMgmtPort, ip_address]}
333   tenant_ip_address:
334     description: IP address of the server in the tenant network
335     value: {get_attr: [TenantPort, ip_address]}
336   management_ip_address:
337     description: IP address of the server in the management network
338     value: {get_attr: [ManagementPort, ip_address]}
339   config_identifier:
340     description: identifier which changes if the node configuration may need re-applying
341     value:
342       list_join:
343         - ','
344         - - {get_attr: [SwiftStorageHieraDeploy, deploy_stdout]}
345           - {get_attr: [NodeTLSCAData, deploy_stdout]}
346           - {get_param: UpdateIdentifier}