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