Merge "Enable glance-api show_image_direct_url for COW"
[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     type: string
49     default: ''
50   EnablePackageInstall:
51     default: 'false'
52     description: Set to true to enable package installation via Puppet
53     type: boolean
54   UpdateIdentifier:
55     default: ''
56     type: string
57     description: >
58       Setting to a previously unused value during stack-update will trigger
59       package update on all nodes
60   ServiceNetMap:
61     default: {}
62     description: Mapping of service_name -> network name. Typically set
63                  via parameter_defaults in the resource registry.
64     type: json
65   Hostname:
66     type: string
67     default: '' # Defaults to Heat created hostname
68   ExtraConfig:
69     default: {}
70     description: |
71       Additional hiera configuration to inject into the cluster. Note
72       that ObjectStorageExtraConfig takes precedence over ExtraConfig.
73     type: json
74   ObjectStorageExtraConfig:
75     default: {}
76     description: |
77       Role specific additional hiera configuration to inject into the cluster.
78     type: json
79
80
81 resources:
82
83   SwiftStorage:
84     type: OS::Nova::Server
85     properties:
86       image: {get_param: Image}
87       flavor: {get_param: Flavor}
88       key_name: {get_param: KeyName}
89       networks:
90         - network: ctlplane
91       user_data_format: SOFTWARE_CONFIG
92       user_data: {get_resource: UserData}
93       name: {get_param: Hostname}
94
95   # Combine the NodeAdminUserData and NodeUserData mime archives
96   UserData:
97     type: OS::Heat::MultipartMime
98     properties:
99       parts:
100       - config: {get_resource: NodeAdminUserData}
101         type: multipart
102       - config: {get_resource: NodeUserData}
103         type: multipart
104
105   # Creates the "heat-admin" user if configured via the environment
106   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
107   NodeAdminUserData:
108     type: OS::TripleO::NodeAdminUserData
109
110   # For optional operator additional userdata
111   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
112   NodeUserData:
113     type: OS::TripleO::NodeUserData
114
115   InternalApiPort:
116     type: OS::TripleO::SwiftStorage::Ports::InternalApiPort
117     properties:
118       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
119
120   StoragePort:
121     type: OS::TripleO::SwiftStorage::Ports::StoragePort
122     properties:
123       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
124
125   StorageMgmtPort:
126     type: OS::TripleO::SwiftStorage::Ports::StorageMgmtPort
127     properties:
128       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
129
130   NetworkConfig:
131     type: OS::TripleO::ObjectStorage::Net::SoftwareConfig
132     properties:
133       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
134       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
135       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
136       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
137
138   NetIpMap:
139     type: OS::TripleO::Network::Ports::NetIpMap
140     properties:
141       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
142       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
143       StorageIp: {get_attr: [StoragePort, ip_address]}
144       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
145
146   NetworkDeployment:
147     type: OS::TripleO::SoftwareDeployment
148     properties:
149       config: {get_resource: NetworkConfig}
150       server: {get_resource: SwiftStorage}
151
152   SwiftStorageHieraConfig:
153     type: OS::Heat::StructuredConfig
154     properties:
155       group: os-apply-config
156       config:
157         hiera:
158           hierarchy:
159             - '"%{::uuid}"'
160             - heat_config_%{::deploy_config_name}
161             - object_extraconfig
162             - extraconfig
163             - object
164             - swift_devices_and_proxy # provided by SwiftDevicesAndProxyConfig
165             - all_nodes # provided by allNodesConfig
166             - '"%{::osfamily}"'
167             - common
168           datafiles:
169             common:
170               raw_data: {get_file: hieradata/common.yaml}
171             object_extraconfig:
172               mapped_data: {get_param: ObjectStorageExtraConfig}
173             extraconfig:
174               mapped_data: {get_param: ExtraConfig}
175             object:
176               raw_data: {get_file: hieradata/object.yaml}
177               mapped_data: # data supplied directly to this deployment configuration, etc
178                 swift::swift_hash_suffix: { get_input: swift_hash_suffix }
179                 tripleo::ringbuilder::part_power: { get_input: swift_part_power }
180                 tripleo::ringbuilder::replicas: {get_input: swift_replicas }
181                 # Swift
182                 swift::storage::all::storage_local_net_ip: {get_input: swift_management_network}
183                 swift_mount_check: {get_input: swift_mount_check }
184                 tripleo::ringbuilder::min_part_hours: { get_input: swift_min_part_hours }
185                 ntp::servers: {get_input: ntp_servers}
186                 # NOTE(dprince): build_ring support is currently not wired in.
187                 # See: https://review.openstack.org/#/c/109225/
188                 tripleo::ringbuilder::build_ring: True
189                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
190                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
191                 tripleo::packages::enable_install: {get_input: enable_package_install}
192                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
193
194
195   SwiftStorageHieraDeploy:
196     type: OS::Heat::StructuredDeployment
197     depends_on: NetworkDeployment
198     properties:
199       server: {get_resource: SwiftStorage}
200       config: {get_resource: SwiftStorageHieraConfig}
201       input_values:
202         local_ip: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
203         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
204         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
205         swift_hash_suffix: {get_param: HashSuffix}
206         swift_mount_check: {get_param: MountCheck}
207         swift_min_part_hours: {get_param: MinPartHours}
208         swift_part_power: {get_param: PartPower}
209         swift_replicas: { get_param: Replicas}
210         ntp_servers:
211           str_replace:
212             template: '["server"]'
213             params:
214               server: {get_param: NtpServer}
215         enable_package_install: {get_param: EnablePackageInstall}
216         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
217         swift_management_network: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
218
219   # Hook for site-specific additional pre-deployment config,
220   # applying to all nodes, e.g node registration/unregistration
221   NodeExtraConfig:
222     depends_on: SwiftStorageHieraDeploy
223     type: OS::TripleO::NodeExtraConfig
224     properties:
225         server: {get_resource: SwiftStorage}
226
227   UpdateConfig:
228     type: OS::TripleO::Tasks::PackageUpdate
229
230   UpdateDeployment:
231     type: OS::Heat::SoftwareDeployment
232     properties:
233       config: {get_resource: UpdateConfig}
234       server: {get_resource: SwiftStorage}
235       input_values:
236         update_identifier:
237           get_param: UpdateIdentifier
238
239 outputs:
240   hosts_entry:
241     value:
242       str_replace:
243         template: "IP HOST.localdomain HOST"
244         params:
245           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ObjectStorageHostnameResolveNetwork]}]}
246           HOST: {get_attr: [SwiftStorage, name]}
247   nova_server_resource:
248     description: Heat resource handle for the swift storage server
249     value:
250       {get_resource: SwiftStorage}
251   swift_device:
252     description: Swift device formatted for swift-ring-builder
253     value:
254       str_replace:
255         template: 'r1z1-IP:%PORT%/d1'
256         params:
257           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
258   internal_api_ip_address:
259     description: IP address of the server in the internal_api network
260     value: {get_attr: [InternalApiPort, ip_address]}
261   storage_ip_address:
262     description: IP address of the server in the storage network
263     value: {get_attr: [StoragePort, ip_address]}
264   storage_mgmt_ip_address:
265     description: IP address of the server in the storage_mgmt network
266     value: {get_attr: [StorageMgmtPort, ip_address]}
267   config_identifier:
268     description: identifier which changes if the node configuration may need re-applying
269     value:
270       list_join:
271         - ','
272         - - {get_attr: [SwiftStorageHieraDeploy, deploy_stdout]}
273           - {get_param: UpdateIdentifier}