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