diff --git a/manifests/loadbalancer.pp b/manifests/loadbalancer.pp index 906a6b43..6d35d31b 100644 --- a/manifests/loadbalancer.pp +++ b/manifests/loadbalancer.pp @@ -56,7 +56,9 @@ class cloud::loadbalancer( $mysql_vip = $os_params::mysql_vip ){ - class { 'haproxy': } + class { 'haproxy': + manage_service => false, + } class { 'keepalived': } @@ -65,11 +67,13 @@ class cloud::loadbalancer( } keepalived::instance { '1': - interface => $keepalived_interface, - virtual_ips => split(join(flatten([$keepalived_ipvs, ['']]), " dev ${keepalived_interface},"), ','), - state => $keepalived_state, - track_script => ['haproxy'], - priority => 50, + interface => $keepalived_interface, + virtual_ips => split(join(flatten([$keepalived_ipvs, ['']]), " dev ${keepalived_interface},"), ','), + state => $keepalived_state, + track_script => ['haproxy'], + priority => 50, + notify_master => '"/etc/init.d/haproxy start"', + notify_backup => '"/etc/init.d/haproxy stop"', } $monitors_data = inline_template(' diff --git a/spec/classes/cloud_loadbalancer_spec.rb b/spec/classes/cloud_loadbalancer_spec.rb index c2dfc322..73a7de84 100644 --- a/spec/classes/cloud_loadbalancer_spec.rb +++ b/spec/classes/cloud_loadbalancer_spec.rb @@ -63,7 +63,9 @@ describe 'cloud::loadbalancer' do end it 'configure haproxy server' do - should contain_class('haproxy') + should contain_class('haproxy').with({ + 'manage_service' => 'false', + }) end it 'configure keepalived server' do @@ -72,7 +74,9 @@ describe 'cloud::loadbalancer' do it 'configure vrrp_instance with MASTER state' do should contain_keepalived__instance('1').with({ - 'state' => 'MASTER', + 'state' => 'MASTER', + 'notify_master' => '"/etc/init.d/haproxy start"', + 'notify_backup' => '"/etc/init.d/haproxy stop"', }) end @@ -121,7 +125,9 @@ describe 'cloud::loadbalancer' do end it 'configure haproxy server' do - should contain_class('haproxy') + should contain_class('haproxy').with({ + 'manage_service' => 'false', + }) end it 'configure keepalived server' do @@ -129,7 +135,10 @@ describe 'cloud::loadbalancer' do end it 'configure vrrp_instance with BACKUP state' do - should contain_keepalived__instance('1') + should contain_keepalived__instance('1').with({ + 'notify_master' => '"/etc/init.d/haproxy start"', + 'notify_backup' => '"/etc/init.d/haproxy stop"', + }) end end