49d916a1bf1175781e6ecfbd4b91ce573f743513
[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 EC2 KeyPair 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   CloudDomain:
84     default: ''
85     type: string
86     description: >
87       The DNS domain used for the hosts. This should match the dhcp_domain
88       configured in the Undercloud neutron. Defaults to localdomain.
89   ServerMetadata:
90     default: {}
91     description: >
92       Extra properties or metadata passed to Nova for the created nodes in
93       the overcloud. It's accessible via the Nova metadata API.
94     type: json
95
96
97 resources:
98
99   SwiftStorage:
100     type: OS::Nova::Server
101     properties:
102       image: {get_param: Image}
103       flavor: {get_param: Flavor}
104       key_name: {get_param: KeyName}
105       networks:
106         - network: ctlplane
107       user_data_format: SOFTWARE_CONFIG
108       user_data: {get_resource: UserData}
109       name: {get_param: Hostname}
110       metadata: {get_param: ServerMetadata}
111
112   # Combine the NodeAdminUserData and NodeUserData mime archives
113   UserData:
114     type: OS::Heat::MultipartMime
115     properties:
116       parts:
117       - config: {get_resource: NodeAdminUserData}
118         type: multipart
119       - config: {get_resource: NodeUserData}
120         type: multipart
121
122   # Creates the "heat-admin" user if configured via the environment
123   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
124   NodeAdminUserData:
125     type: OS::TripleO::NodeAdminUserData
126
127   # For optional operator additional userdata
128   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
129   NodeUserData:
130     type: OS::TripleO::NodeUserData
131
132   InternalApiPort:
133     type: OS::TripleO::SwiftStorage::Ports::InternalApiPort
134     properties:
135       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
136
137   StoragePort:
138     type: OS::TripleO::SwiftStorage::Ports::StoragePort
139     properties:
140       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
141
142   StorageMgmtPort:
143     type: OS::TripleO::SwiftStorage::Ports::StorageMgmtPort
144     properties:
145       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
146
147   NetworkConfig:
148     type: OS::TripleO::ObjectStorage::Net::SoftwareConfig
149     properties:
150       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
151       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
152       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
153       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
154
155   NetIpMap:
156     type: OS::TripleO::Network::Ports::NetIpMap
157     properties:
158       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
159       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
160       StorageIp: {get_attr: [StoragePort, ip_address]}
161       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
162
163   NetworkDeployment:
164     type: OS::TripleO::SoftwareDeployment
165     properties:
166       config: {get_resource: NetworkConfig}
167       server: {get_resource: SwiftStorage}
168       actions: {get_param: NetworkDeploymentActions}
169
170   SwiftStorageHieraConfig:
171     type: OS::Heat::StructuredConfig
172     properties:
173       group: os-apply-config
174       config:
175         hiera:
176           hierarchy:
177             - '"%{::uuid}"'
178             - heat_config_%{::deploy_config_name}
179             - object_extraconfig
180             - extraconfig
181             - object
182             - swift_devices_and_proxy # provided by SwiftDevicesAndProxyConfig
183             - all_nodes # provided by allNodesConfig
184             - '"%{::osfamily}"'
185             - common
186           datafiles:
187             common:
188               raw_data: {get_file: hieradata/common.yaml}
189             object_extraconfig:
190               mapped_data: {get_param: ObjectStorageExtraConfig}
191             extraconfig:
192               mapped_data: {get_param: ExtraConfig}
193             object:
194               raw_data: {get_file: hieradata/object.yaml}
195               mapped_data: # data supplied directly to this deployment configuration, etc
196                 swift::swift_hash_suffix: { get_input: swift_hash_suffix }
197                 tripleo::ringbuilder::part_power: { get_input: swift_part_power }
198                 tripleo::ringbuilder::replicas: {get_input: swift_replicas }
199                 # Swift
200                 swift::storage::all::storage_local_net_ip: {get_input: swift_management_network}
201                 swift_mount_check: {get_input: swift_mount_check }
202                 tripleo::ringbuilder::min_part_hours: { get_input: swift_min_part_hours }
203                 ntp::servers: {get_input: ntp_servers}
204                 # NOTE(dprince): build_ring support is currently not wired in.
205                 # See: https://review.openstack.org/#/c/109225/
206                 tripleo::ringbuilder::build_ring: True
207                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
208                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
209                 tripleo::packages::enable_install: {get_input: enable_package_install}
210                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
211
212
213   SwiftStorageHieraDeploy:
214     type: OS::Heat::StructuredDeployment
215     depends_on: NetworkDeployment
216     properties:
217       server: {get_resource: SwiftStorage}
218       config: {get_resource: SwiftStorageHieraConfig}
219       input_values:
220         local_ip: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
221         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
222         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
223         swift_hash_suffix: {get_param: HashSuffix}
224         swift_mount_check: {get_param: MountCheck}
225         swift_min_part_hours: {get_param: MinPartHours}
226         swift_part_power: {get_param: PartPower}
227         swift_replicas: { get_param: Replicas}
228         ntp_servers: {get_param: NtpServer}
229         enable_package_install: {get_param: EnablePackageInstall}
230         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
231         swift_management_network: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
232
233   # Resource for site-specific injection of root certificate
234   NodeTLSCAData:
235     depends_on: SwiftStorageHieraDeploy
236     type: OS::TripleO::NodeTLSCAData
237     properties:
238       server: {get_resource: SwiftStorage}
239
240   # Hook for site-specific additional pre-deployment config,
241   # applying to all nodes, e.g node registration/unregistration
242   NodeExtraConfig:
243     depends_on: NodeTLSCAData
244     type: OS::TripleO::NodeExtraConfig
245     properties:
246         server: {get_resource: SwiftStorage}
247
248   UpdateConfig:
249     type: OS::TripleO::Tasks::PackageUpdate
250
251   UpdateDeployment:
252     type: OS::Heat::SoftwareDeployment
253     properties:
254       config: {get_resource: UpdateConfig}
255       server: {get_resource: SwiftStorage}
256       input_values:
257         update_identifier:
258           get_param: UpdateIdentifier
259
260 outputs:
261   hosts_entry:
262     value:
263       str_replace:
264         template: "IP HOST.DOMAIN HOST"
265         params:
266           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ObjectStorageHostnameResolveNetwork]}]}
267           DOMAIN: {get_param: CloudDomain}
268           HOST: {get_attr: [SwiftStorage, name]}
269   nova_server_resource:
270     description: Heat resource handle for the swift storage server
271     value:
272       {get_resource: SwiftStorage}
273   swift_device:
274     description: Swift device formatted for swift-ring-builder
275     value:
276       str_replace:
277         template: 'r1z1-IP:%PORT%/d1'
278         params:
279           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
280   internal_api_ip_address:
281     description: IP address of the server in the internal_api network
282     value: {get_attr: [InternalApiPort, ip_address]}
283   storage_ip_address:
284     description: IP address of the server in the storage network
285     value: {get_attr: [StoragePort, ip_address]}
286   storage_mgmt_ip_address:
287     description: IP address of the server in the storage_mgmt network
288     value: {get_attr: [StorageMgmtPort, ip_address]}
289   config_identifier:
290     description: identifier which changes if the node configuration may need re-applying
291     value:
292       list_join:
293         - ','
294         - - {get_attr: [SwiftStorageHieraDeploy, deploy_stdout]}
295           - {get_attr: [NodeTLSCAData, deploy_stdout]}
296           - {get_param: UpdateIdentifier}