From 9cf09c6e6e001d8042886f4453f42ddfb5b0fa10 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Mon, 5 May 2014 15:50:47 +0200 Subject: [PATCH] loadbalancer: revert service_manage for haproxy We need to manage the service, otherwise each time Puppet will change the configuration of HAproxy, the service won't restart. - Set to false only: Service will never start even by Keepalived - Set to false with tricking init script: Service will start once, only by Keealived but never restart after each config change - Set to true: Service will be managed on all nodes, no ERROR, only warnings on BACKUP nodes, regarding binding. For now, we switch to true and we plan to patch puppetlabs-haproxy to improve it. --- manifests/loadbalancer.pp | 8 +------- spec/classes/cloud_loadbalancer_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/manifests/loadbalancer.pp b/manifests/loadbalancer.pp index 6db9a04e..8dd98876 100644 --- a/manifests/loadbalancer.pp +++ b/manifests/loadbalancer.pp @@ -233,13 +233,7 @@ class cloud::loadbalancer( # Ensure Keepalived is started before HAproxy to avoid binding errors. class { 'keepalived': } -> class { 'haproxy': - service_manage => false - } - # Still allow HAproxy to start - if ($::osfamily == 'Debian') { - file { '/etc/default/haproxy': - content => 'ENABLED=1' - } + service_manage => true } keepalived::vrrp_script { 'haproxy': diff --git a/spec/classes/cloud_loadbalancer_spec.rb b/spec/classes/cloud_loadbalancer_spec.rb index ede4afb0..9a87264a 100644 --- a/spec/classes/cloud_loadbalancer_spec.rb +++ b/spec/classes/cloud_loadbalancer_spec.rb @@ -124,7 +124,7 @@ describe 'cloud::loadbalancer' do }) end # configure vrrp_instance with BACKUP state it 'configure haproxy server without service managed' do - should contain_class('haproxy').with(:service_manage => false) + should contain_class('haproxy').with(:service_manage => true) end # configure haproxy server end # configure keepalived in backup @@ -143,7 +143,7 @@ describe 'cloud::loadbalancer' do }) end it 'configure haproxy server with service managed' do - should contain_class('haproxy').with(:service_manage => false) + should contain_class('haproxy').with(:service_manage => true) end # configure haproxy server end # configure keepalived in master