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