1 # Copyright 2014 Red Hat, Inc.
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
16 class tripleo::loadbalancer (
17 $keystone_admin = false,
18 $keystone_public = false,
22 $glance_registry = false,
25 $nova_metadata = false,
26 $nova_novncproxy = false,
28 $swift_proxy_server = false,
30 $heat_cloudwatch = false,
39 $keepalived_name_is_process = false
40 $keepalived_vrrp_script = 'systemctl status haproxy.service'
43 $keepalived_name_is_process = true
44 $keepalived_vrrp_script = undef
48 class { 'keepalived': }
49 keepalived::vrrp_script { 'haproxy':
50 name_is_process => $keepalived_name_is_process,
51 script => $keepalived_vrrp_script,
54 # KEEPALIVE INSTANCE CONTROL
55 keepalived::instance { '51':
56 interface => hiera('control_virtual_interface'),
57 virtual_ips => [join([hiera('controller_virtual_ip'), ' dev ', hiera('control_virtual_interface')])],
59 track_script => ['haproxy'],
63 # KEEPALIVE INSTANCE PUBLIC
64 keepalived::instance { '52':
65 interface => hiera('public_virtual_interface'),
66 virtual_ips => [join([hiera('public_virtual_ip'), ' dev ', hiera('public_virtual_interface')])],
68 track_script => ['haproxy'],
72 sysctl::value { 'net.ipv4.ip_nonlocal_bind': value => '1' }
76 'log' => '/dev/log local0',
77 'pidfile' => '/var/run/haproxy.pid',
88 'option' => [ 'tcpka', 'tcplog' ],
89 'timeout' => [ 'http-request 10s', 'queue 1m', 'connect 10s', 'client 1m', 'server 1m', 'check 10s' ],
93 haproxy::listen { 'haproxy.stats':
100 collect_exported => false,
104 haproxy::listen { 'keystone_admin':
105 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
107 options => { 'option' => [ 'httpchk GET /' ] },
108 collect_exported => false,
110 haproxy::balancermember { 'keystone_admin':
111 listening_service => 'keystone_admin',
113 ipaddresses => hiera('controller_host'),
114 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
118 if $keystone_public {
119 haproxy::listen { 'keystone_public':
120 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
122 options => { 'option' => [ 'httpchk GET /' ] },
123 collect_exported => false,
125 haproxy::balancermember { 'keystone_public':
126 listening_service => 'keystone_public',
128 ipaddresses => hiera('controller_host'),
129 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
134 haproxy::listen { 'neutron':
135 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
137 options => { 'option' => [ 'httpchk GET /' ] },
138 collect_exported => false,
140 haproxy::balancermember { 'neutron':
141 listening_service => 'neutron',
143 ipaddresses => hiera('controller_host'),
144 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
149 haproxy::listen { 'cinder':
150 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
152 options => { 'option' => [ 'httpchk GET /' ] },
153 collect_exported => false,
155 haproxy::balancermember { 'cinder':
156 listening_service => 'cinder',
158 ipaddresses => hiera('controller_host'),
159 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
164 haproxy::listen { 'glance_api':
165 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
167 options => { 'option' => [ 'httpchk GET /' ] },
168 collect_exported => false,
170 haproxy::balancermember { 'glance_api':
171 listening_service => 'glance_api',
173 ipaddresses => hiera('controller_host'),
174 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
179 if $glance_registry {
180 haproxy::listen { 'glance_registry':
181 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
183 options => { 'option' => [ 'httpchk GET /' ] },
184 collect_exported => false,
186 haproxy::balancermember { 'glance_registry':
187 listening_service => 'glance_registry',
189 ipaddresses => hiera('controller_host'),
190 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
195 haproxy::listen { 'nova_ec2':
196 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
198 options => { 'option' => [ 'httpchk GET /' ] },
199 collect_exported => false,
201 haproxy::balancermember { 'nova_ec2':
202 listening_service => 'nova_ec2',
204 ipaddresses => hiera('controller_host'),
205 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
210 haproxy::listen { 'nova_osapi':
211 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
213 options => { 'option' => [ 'httpchk GET /' ] },
214 collect_exported => false,
216 haproxy::balancermember { 'nova_osapi':
217 listening_service => 'nova_osapi',
219 ipaddresses => hiera('controller_host'),
220 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
225 haproxy::listen { 'nova_metadata':
226 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
228 options => { 'option' => [ 'httpchk GET /' ] },
229 collect_exported => false,
231 haproxy::balancermember { 'nova_metadata':
232 listening_service => 'nova_metadata',
234 ipaddresses => hiera('controller_host'),
235 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
239 if $nova_novncproxy {
240 haproxy::listen { 'nova_novncproxy':
241 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
243 options => { 'option' => [ 'httpchk GET /' ] },
244 collect_exported => false,
246 haproxy::balancermember { 'nova_novncproxy':
247 listening_service => 'nova_novncproxy',
249 ipaddresses => hiera('controller_host'),
250 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
255 haproxy::listen { 'ceilometer':
256 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
258 collect_exported => false,
260 haproxy::balancermember { 'ceilometer':
261 listening_service => 'ceilometer',
263 ipaddresses => hiera('controller_host'),
268 if $swift_proxy_server {
269 haproxy::listen { 'swift_proxy_server':
270 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
272 options => { 'option' => [ 'httpchk GET /info' ] },
273 collect_exported => false,
275 haproxy::balancermember { 'swift_proxy_server':
276 listening_service => 'swift_proxy_server',
278 ipaddresses => hiera('controller_host'),
279 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
284 haproxy::listen { 'heat_api':
285 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
287 options => { 'option' => [ 'httpchk GET /' ] },
288 collect_exported => false,
290 haproxy::balancermember { 'heat_api':
291 listening_service => 'heat_api',
293 ipaddresses => hiera('controller_host'),
294 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
298 if $heat_cloudwatch {
299 haproxy::listen { 'heat_cloudwatch':
300 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
302 options => { 'option' => [ 'httpchk GET /' ] },
303 collect_exported => false,
305 haproxy::balancermember { 'heat_cloudwatch':
306 listening_service => 'heat_cloudwatch',
308 ipaddresses => hiera('controller_host'),
309 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
314 haproxy::listen { 'heat_cfn':
315 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
317 options => { 'option' => [ 'httpchk GET /' ] },
318 collect_exported => false,
320 haproxy::balancermember { 'heat_cfn':
321 listening_service => 'heat_cfn',
323 ipaddresses => hiera('controller_host'),
324 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
329 haproxy::listen { 'horizon':
330 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
332 options => { 'option' => [ 'httpchk GET /' ] },
333 collect_exported => false,
335 haproxy::balancermember { 'horizon':
336 listening_service => 'horizon',
338 ipaddresses => hiera('controller_host'),
339 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
344 haproxy::listen { 'mysql':
345 ipaddress => [hiera('controller_virtual_ip')],
347 options => { 'timeout' => [ 'client 0', 'server 0' ] },
348 collect_exported => false,
350 haproxy::balancermember { 'mysql':
351 listening_service => 'mysql',
353 ipaddresses => hiera('controller_host'),
354 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
359 haproxy::listen { 'rabbitmq':
360 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
362 options => { 'timeout' => [ 'client 0', 'server 0' ] },
363 collect_exported => false,
365 haproxy::balancermember { 'rabbitmq':
366 listening_service => 'rabbitmq',
368 ipaddresses => hiera('controller_host'),
369 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
375 include ::tripleo::loadbalancer