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 if !str2bool(hiera('enable_package_install', 'false')) {
19 Package { provider => 'norpm' } # provided by tripleo-puppet
22 warning('enable_package_install option not supported.')
27 class tripleo::loadbalancer (
28 $keystone_admin = false,
29 $keystone_public = false,
33 $glance_registry = false,
36 $nova_metadata = false,
37 $nova_novncproxy = false,
39 $swift_proxy_server = false,
41 $heat_cloudwatch = false,
50 $keepalived_name_is_process = false
51 $keepalived_vrrp_script = 'systemctl status haproxy.service'
54 $keepalived_name_is_process = true
55 $keepalived_vrrp_script = undef
59 class { 'keepalived': }
60 keepalived::vrrp_script { 'haproxy':
61 name_is_process => $keepalived_name_is_process,
62 script => $keepalived_vrrp_script,
65 # KEEPALIVE INSTANCE CONTROL
66 keepalived::instance { '51':
67 interface => hiera('control_virtual_interface'),
68 virtual_ips => [join([hiera('controller_virtual_ip'), ' dev ', hiera('control_virtual_interface')])],
70 track_script => ['haproxy'],
74 # KEEPALIVE INSTANCE PUBLIC
75 keepalived::instance { '52':
76 interface => hiera('public_virtual_interface'),
77 virtual_ips => [join([hiera('public_virtual_ip'), ' dev ', hiera('public_virtual_interface')])],
79 track_script => ['haproxy'],
83 sysctl::value { 'net.ipv4.ip_nonlocal_bind': value => '1' }
87 'log' => '/dev/log local0',
88 'pidfile' => '/var/run/haproxy.pid',
99 'option' => [ 'tcpka', 'tcplog' ],
100 'timeout' => [ 'http-request 10s', 'queue 1m', 'connect 10s', 'client 1m', 'server 1m', 'check 10s' ],
104 haproxy::listen { 'haproxy.stats':
111 collect_exported => false,
115 haproxy::listen { 'keystone_admin':
116 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
118 options => { 'option' => [ 'httpchk GET /' ] },
119 collect_exported => false,
121 haproxy::balancermember { 'keystone_admin':
122 listening_service => 'keystone_admin',
124 ipaddresses => hiera('controller_host'),
125 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
129 if $keystone_public {
130 haproxy::listen { 'keystone_public':
131 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
133 options => { 'option' => [ 'httpchk GET /' ] },
134 collect_exported => false,
136 haproxy::balancermember { 'keystone_public':
137 listening_service => 'keystone_public',
139 ipaddresses => hiera('controller_host'),
140 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
145 haproxy::listen { 'neutron':
146 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
148 options => { 'option' => [ 'httpchk GET /' ] },
149 collect_exported => false,
151 haproxy::balancermember { 'neutron':
152 listening_service => 'neutron',
154 ipaddresses => hiera('controller_host'),
155 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
160 haproxy::listen { 'cinder':
161 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
163 options => { 'option' => [ 'httpchk GET /' ] },
164 collect_exported => false,
166 haproxy::balancermember { 'cinder':
167 listening_service => 'cinder',
169 ipaddresses => hiera('controller_host'),
170 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
175 haproxy::listen { 'glance_api':
176 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
178 options => { 'option' => [ 'httpchk GET /' ] },
179 collect_exported => false,
181 haproxy::balancermember { 'glance_api':
182 listening_service => 'glance_api',
184 ipaddresses => hiera('controller_host'),
185 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
190 if $glance_registry {
191 haproxy::listen { 'glance_registry':
192 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
194 options => { 'option' => [ 'httpchk GET /' ] },
195 collect_exported => false,
197 haproxy::balancermember { 'glance_registry':
198 listening_service => 'glance_registry',
200 ipaddresses => hiera('controller_host'),
201 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
206 haproxy::listen { 'nova_ec2':
207 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
209 options => { 'option' => [ 'httpchk GET /' ] },
210 collect_exported => false,
212 haproxy::balancermember { 'nova_ec2':
213 listening_service => 'nova_ec2',
215 ipaddresses => hiera('controller_host'),
216 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
221 haproxy::listen { 'nova_osapi':
222 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
224 options => { 'option' => [ 'httpchk GET /' ] },
225 collect_exported => false,
227 haproxy::balancermember { 'nova_osapi':
228 listening_service => 'nova_osapi',
230 ipaddresses => hiera('controller_host'),
231 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
236 haproxy::listen { 'nova_metadata':
237 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
239 options => { 'option' => [ 'httpchk GET /' ] },
240 collect_exported => false,
242 haproxy::balancermember { 'nova_metadata':
243 listening_service => 'nova_metadata',
245 ipaddresses => hiera('controller_host'),
246 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
250 if $nova_novncproxy {
251 haproxy::listen { 'nova_novncproxy':
252 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
254 options => { 'option' => [ 'httpchk GET /' ] },
255 collect_exported => false,
257 haproxy::balancermember { 'nova_novncproxy':
258 listening_service => 'nova_novncproxy',
260 ipaddresses => hiera('controller_host'),
261 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
266 haproxy::listen { 'ceilometer':
267 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
269 collect_exported => false,
271 haproxy::balancermember { 'ceilometer':
272 listening_service => 'ceilometer',
274 ipaddresses => hiera('controller_host'),
279 if $swift_proxy_server {
280 haproxy::listen { 'swift_proxy_server':
281 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
283 options => { 'option' => [ 'httpchk GET /info' ] },
284 collect_exported => false,
286 haproxy::balancermember { 'swift_proxy_server':
287 listening_service => 'swift_proxy_server',
289 ipaddresses => hiera('controller_host'),
290 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
295 haproxy::listen { 'heat_api':
296 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
298 options => { 'option' => [ 'httpchk GET /' ] },
299 collect_exported => false,
301 haproxy::balancermember { 'heat_api':
302 listening_service => 'heat_api',
304 ipaddresses => hiera('controller_host'),
305 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
309 if $heat_cloudwatch {
310 haproxy::listen { 'heat_cloudwatch':
311 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
313 options => { 'option' => [ 'httpchk GET /' ] },
314 collect_exported => false,
316 haproxy::balancermember { 'heat_cloudwatch':
317 listening_service => 'heat_cloudwatch',
319 ipaddresses => hiera('controller_host'),
320 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
325 haproxy::listen { 'heat_cfn':
326 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
328 options => { 'option' => [ 'httpchk GET /' ] },
329 collect_exported => false,
331 haproxy::balancermember { 'heat_cfn':
332 listening_service => 'heat_cfn',
334 ipaddresses => hiera('controller_host'),
335 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
340 haproxy::listen { 'horizon':
341 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
343 options => { 'option' => [ 'httpchk GET /' ] },
344 collect_exported => false,
346 haproxy::balancermember { 'horizon':
347 listening_service => 'horizon',
349 ipaddresses => hiera('controller_host'),
350 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
355 haproxy::listen { 'mysql':
356 ipaddress => [hiera('controller_virtual_ip')],
358 options => { 'timeout' => [ 'client 0', 'server 0' ] },
359 collect_exported => false,
361 haproxy::balancermember { 'mysql':
362 listening_service => 'mysql',
364 ipaddresses => hiera('controller_host'),
365 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
370 haproxy::listen { 'rabbitmq':
371 ipaddress => [hiera('controller_virtual_ip'), hiera('public_virtual_ip')],
373 options => { 'timeout' => [ 'client 0', 'server 0' ] },
374 collect_exported => false,
376 haproxy::balancermember { 'rabbitmq':
377 listening_service => 'rabbitmq',
379 ipaddresses => hiera('controller_host'),
380 options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
386 include ::tripleo::loadbalancer