From 63bd49e069967434864985c6934b66550e74ff4b Mon Sep 17 00:00:00 2001 From: Giulio Fidente Date: Wed, 15 Apr 2015 11:56:24 +0200 Subject: [PATCH] Make configuration of keepalived optional Change-Id: I98b9b3dbc48009ce255d964ac580e1a31f279f1e --- manifests/loadbalancer.pp | 75 +++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 34 deletions(-) diff --git a/manifests/loadbalancer.pp b/manifests/loadbalancer.pp index ccc9d250f..819ce10c2 100644 --- a/manifests/loadbalancer.pp +++ b/manifests/loadbalancer.pp @@ -19,6 +19,10 @@ # # === Parameters: # +# [*manage_vip*] +# Whether to enable keepalived to manage the VIPs or not +# Defaults to true +# # [*controller_host*] # (Deprecated)Host or group of hosts to load-balance the services # Can be a string or an array. @@ -139,6 +143,7 @@ class tripleo::loadbalancer ( $control_virtual_interface, $public_virtual_interface, $public_virtual_ip, + $manage_vip = true, $controller_host = undef, $controller_hosts = undef, $controller_hosts_names = undef, @@ -180,44 +185,46 @@ class tripleo::loadbalancer ( $controller_hosts_names_real = $controller_hosts_names } - case $::osfamily { - 'RedHat': { - $keepalived_name_is_process = false - $keepalived_vrrp_script = 'systemctl status haproxy.service' - } # RedHat - 'Debian': { - $keepalived_name_is_process = true - $keepalived_vrrp_script = undef + if $enable_keepalived { + case $::osfamily { + 'RedHat': { + $keepalived_name_is_process = false + $keepalived_vrrp_script = 'systemctl status haproxy.service' + } # RedHat + 'Debian': { + $keepalived_name_is_process = true + $keepalived_vrrp_script = undef + } + default: { + warning('Please configure keepalived defaults in tripleo::loadbalancer.') + $keepalived_name_is_process = undef + $keepalived_vrrp_script = undef + } } - default: { - warning('Please configure keepalived defaults in tripleo::loadbalancer.') - $keepalived_name_is_process = undef - $keepalived_vrrp_script = undef + + class { '::keepalived': } + keepalived::vrrp_script { 'haproxy': + name_is_process => $keepalived_name_is_process, + script => $keepalived_vrrp_script, } - } - class { '::keepalived': } - keepalived::vrrp_script { 'haproxy': - name_is_process => $keepalived_name_is_process, - script => $keepalived_vrrp_script, - } + # KEEPALIVE INSTANCE CONTROL + keepalived::instance { '51': + interface => $control_virtual_interface, + virtual_ips => [join([$controller_virtual_ip, ' dev ', $control_virtual_interface])], + state => 'MASTER', + track_script => ['haproxy'], + priority => 101, + } - # KEEPALIVE INSTANCE CONTROL - keepalived::instance { '51': - interface => $control_virtual_interface, - virtual_ips => [join([$controller_virtual_ip, ' dev ', $control_virtual_interface])], - state => 'MASTER', - track_script => ['haproxy'], - priority => 101, - } - - # KEEPALIVE INSTANCE PUBLIC - keepalived::instance { '52': - interface => $public_virtual_interface, - virtual_ips => [join([$public_virtual_ip, ' dev ', $public_virtual_interface])], - state => 'MASTER', - track_script => ['haproxy'], - priority => 101, + # KEEPALIVE INSTANCE PUBLIC + keepalived::instance { '52': + interface => $public_virtual_interface, + virtual_ips => [join([$public_virtual_ip, ' dev ', $public_virtual_interface])], + state => 'MASTER', + track_script => ['haproxy'], + priority => 101, + } } sysctl::value { 'net.ipv4.ip_nonlocal_bind': value => '1' }