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