use systemctl on rh7 instead /etc/init.d
use os_familly to specify how to start/stop haproxy
This commit is contained in:
parent
12f76f4afd
commit
fc797d5d92
@ -261,6 +261,22 @@ class cloud::loadbalancer(
|
||||
$keepalived_ipvs = false,
|
||||
){
|
||||
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
# Specific to Red Hat
|
||||
$start_haproxy_service = '"/usr/bin/systemctl start haproxy"'
|
||||
$stop_haproxy_service = '"/usr/bin/systemctl stop haproxy"'
|
||||
} # RedHat
|
||||
'Debian': {
|
||||
# Specific to Debian / Ubuntu
|
||||
$start_haproxy_service = '"/etc/init.d/haproxy start"'
|
||||
$stop_haproxy_service = '"/etc/init.d/haproxy stop"'
|
||||
} # Debian
|
||||
default: {
|
||||
err "${::osfamily} not supported yet"
|
||||
}
|
||||
}
|
||||
|
||||
# Manage deprecation when using old parameters
|
||||
if $keepalived_interface {
|
||||
warning('keepalived_interface parameter is deprecated. Use internal/external parameters instead.')
|
||||
@ -310,8 +326,8 @@ class cloud::loadbalancer(
|
||||
priority => $keepalived_priority,
|
||||
auth_type => $keepalived_auth_type,
|
||||
auth_pass => $keepalived_auth_pass,
|
||||
notify_master => '"/etc/init.d/haproxy start"',
|
||||
notify_backup => '"/etc/init.d/haproxy stop"',
|
||||
notify_master => $start_haproxy_service,
|
||||
notify_backup => $stop_haproxy_service,
|
||||
}
|
||||
|
||||
if !empty($keepalived_internal_ipvs) {
|
||||
@ -328,8 +344,8 @@ class cloud::loadbalancer(
|
||||
priority => $keepalived_priority,
|
||||
auth_type => $keepalived_auth_type,
|
||||
auth_pass => $keepalived_auth_pass,
|
||||
notify_master => '"/etc/init.d/haproxy start"',
|
||||
notify_backup => '"/etc/init.d/haproxy stop"',
|
||||
notify_master => $start_haproxy_service,
|
||||
notify_backup => $stop_haproxy_service,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,8 +115,8 @@ describe 'cloud::loadbalancer' do
|
||||
'priority' => params[:keepalived_priority],
|
||||
'auth_type' => 'PASS',
|
||||
'auth_pass' => 'secret',
|
||||
'notify_master' => '"/etc/init.d/haproxy start"',
|
||||
'notify_backup' => '"/etc/init.d/haproxy stop"',
|
||||
'notify_master' => "#{platform_params[:start_haproxy_service]}",
|
||||
'notify_backup' => "#{platform_params[:stop_haproxy_service]}",
|
||||
})
|
||||
end
|
||||
end
|
||||
@ -139,8 +139,9 @@ describe 'cloud::loadbalancer' do
|
||||
'priority' => params[:keepalived_priority],
|
||||
'auth_type' => 'PASS',
|
||||
'auth_pass' => 'secret',
|
||||
'notify_master' => '"/etc/init.d/haproxy start"',
|
||||
'notify_backup' => '"/etc/init.d/haproxy stop"',
|
||||
'notify_master' => "#{platform_params[:start_haproxy_service]}",
|
||||
'notify_backup' => "#{platform_params[:stop_haproxy_service]}",
|
||||
|
||||
})
|
||||
end
|
||||
end
|
||||
@ -166,8 +167,8 @@ describe 'cloud::loadbalancer' do
|
||||
'priority' => params[:keepalived_priority],
|
||||
'auth_type' => 'PASS',
|
||||
'auth_pass' => 'secret',
|
||||
'notify_master' => '"/etc/init.d/haproxy start"',
|
||||
'notify_backup' => '"/etc/init.d/haproxy stop"',
|
||||
'notify_master' => "#{platform_params[:start_haproxy_service]}",
|
||||
'notify_backup' => "#{platform_params[:stop_haproxy_service]}",
|
||||
})
|
||||
end # configure vrrp_instance with BACKUP state
|
||||
it 'configure haproxy server without service managed' do
|
||||
@ -187,8 +188,8 @@ describe 'cloud::loadbalancer' do
|
||||
'priority' => params[:keepalived_priority],
|
||||
'auth_type' => 'PASS',
|
||||
'auth_pass' => 'secret',
|
||||
'notify_master' => '"/etc/init.d/haproxy start"',
|
||||
'notify_backup' => '"/etc/init.d/haproxy stop"',
|
||||
'notify_master' => "#{platform_params[:start_haproxy_service]}",
|
||||
'notify_backup' => "#{platform_params[:stop_haproxy_service]}",
|
||||
})
|
||||
end
|
||||
it 'configure haproxy server with service managed' do
|
||||
@ -501,7 +502,10 @@ describe 'cloud::loadbalancer' do
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :auth_url => 'horizon' }
|
||||
{ :auth_url => 'horizon',
|
||||
:start_haproxy_service => '"/etc/init.d/haproxy start"',
|
||||
:stop_haproxy_service => '"/etc/init.d/haproxy stop"',
|
||||
}
|
||||
end
|
||||
|
||||
it_configures 'openstack loadbalancer'
|
||||
@ -515,9 +519,13 @@ describe 'cloud::loadbalancer' do
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :auth_url => 'dashboard' }
|
||||
{ :auth_url => 'dashboard',
|
||||
:start_haproxy_service => '"/usr/bin/systemctl start haproxy"',
|
||||
:stop_haproxy_service => '"/usr/bin/systemctl stop haproxy"',
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
it_configures 'openstack loadbalancer'
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user