From d6045832322d756eade6984a52a623fec190751d Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Mon, 5 May 2014 13:56:13 +0200 Subject: [PATCH] loadbalancer: don't manage HAproxy service but allow it to start Signed-off-by: Emilien Macchi --- manifests/loadbalancer.pp | 15 ++++++++------- spec/classes/cloud_loadbalancer_spec.rb | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/manifests/loadbalancer.pp b/manifests/loadbalancer.pp index 6cda1272..4d5e4df9 100644 --- a/manifests/loadbalancer.pp +++ b/manifests/loadbalancer.pp @@ -231,15 +231,16 @@ class cloud::loadbalancer( } # Ensure Keepalived is started before HAproxy to avoid binding errors. - # Also, manage HAproxy only where Keepalived is MASTER - if $keepalived_state == 'BACKUP' { - $manage_haproxy_service = false - } else { - $manage_haproxy_service = true - } class { 'keepalived': } -> class { 'haproxy': - service_manage => $manage_haproxy_service + service_manage => false + } + # Still allow HAproxy to start + if ($::osfamily == 'Debian') { + file { '/etc/default/haproxy': + content => 'ENABLED=1', + before => Service['haproxy'], + } } keepalived::vrrp_script { 'haproxy': diff --git a/spec/classes/cloud_loadbalancer_spec.rb b/spec/classes/cloud_loadbalancer_spec.rb index 65bed2f3..ede4afb0 100644 --- a/spec/classes/cloud_loadbalancer_spec.rb +++ b/spec/classes/cloud_loadbalancer_spec.rb @@ -143,7 +143,7 @@ describe 'cloud::loadbalancer' do }) end it 'configure haproxy server with service managed' do - should contain_class('haproxy').with(:service_manage => true) + should contain_class('haproxy').with(:service_manage => false) end # configure haproxy server end # configure keepalived in master