loadbalancer: Enable priority selection
One can now define the priority of the vrrp router close #25
This commit is contained in:
committed by
Sebastien Badia
parent
183b99c0d2
commit
491f7bd307
@@ -34,6 +34,7 @@ class cloud::loadbalancer(
|
|||||||
$spice = true,
|
$spice = true,
|
||||||
$haproxy_auth = $os_params::haproxy_auth,
|
$haproxy_auth = $os_params::haproxy_auth,
|
||||||
$keepalived_state = 'BACKUP',
|
$keepalived_state = 'BACKUP',
|
||||||
|
$keepalived_priority = 50,
|
||||||
$keepalived_interface = $os_params::keepalived_interface,
|
$keepalived_interface = $os_params::keepalived_interface,
|
||||||
$keepalived_ipvs = [ $os_params::openstack_vip, $os_params::mysql_vip ],
|
$keepalived_ipvs = [ $os_params::openstack_vip, $os_params::mysql_vip ],
|
||||||
$keepalived_localhost_ip = $os_params::keepalived_localhost_ip,
|
$keepalived_localhost_ip = $os_params::keepalived_localhost_ip,
|
||||||
@@ -71,7 +72,7 @@ class cloud::loadbalancer(
|
|||||||
virtual_ips => split(join(flatten([$keepalived_ipvs, ['']]), " dev ${keepalived_interface},"), ','),
|
virtual_ips => split(join(flatten([$keepalived_ipvs, ['']]), " dev ${keepalived_interface},"), ','),
|
||||||
state => $keepalived_state,
|
state => $keepalived_state,
|
||||||
track_script => ['haproxy'],
|
track_script => ['haproxy'],
|
||||||
priority => 50,
|
priority => $keepalived_priority,
|
||||||
notify_master => '"/etc/init.d/haproxy start"',
|
notify_master => '"/etc/init.d/haproxy start"',
|
||||||
notify_backup => '"/etc/init.d/haproxy stop"',
|
notify_backup => '"/etc/init.d/haproxy stop"',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ describe 'cloud::loadbalancer' do
|
|||||||
:spice => true,
|
:spice => true,
|
||||||
:haproxy_auth => 'root:secrete',
|
:haproxy_auth => 'root:secrete',
|
||||||
:keepalived_state => 'MASTER',
|
:keepalived_state => 'MASTER',
|
||||||
|
:keepalived_priority => 50,
|
||||||
:keepalived_interface => 'eth0',
|
:keepalived_interface => 'eth0',
|
||||||
:keepalived_ipvs => ['10.0.0.1', '10.0.0.2'],
|
:keepalived_ipvs => ['10.0.0.1', '10.0.0.2'],
|
||||||
:keepalived_localhost_ip => '127.0.0.1',
|
:keepalived_localhost_ip => '127.0.0.1',
|
||||||
@@ -75,6 +76,7 @@ describe 'cloud::loadbalancer' do
|
|||||||
it 'configure vrrp_instance with MASTER state' do
|
it 'configure vrrp_instance with MASTER state' do
|
||||||
should contain_keepalived__instance('1').with({
|
should contain_keepalived__instance('1').with({
|
||||||
'state' => 'MASTER',
|
'state' => 'MASTER',
|
||||||
|
'priority' => 50,
|
||||||
'notify_master' => '"/etc/init.d/haproxy start"',
|
'notify_master' => '"/etc/init.d/haproxy start"',
|
||||||
'notify_backup' => '"/etc/init.d/haproxy stop"',
|
'notify_backup' => '"/etc/init.d/haproxy stop"',
|
||||||
})
|
})
|
||||||
@@ -102,6 +104,7 @@ describe 'cloud::loadbalancer' do
|
|||||||
:spice => true,
|
:spice => true,
|
||||||
:haproxy_auth => 'root:secrete',
|
:haproxy_auth => 'root:secrete',
|
||||||
:keepalived_state => 'BACKUP',
|
:keepalived_state => 'BACKUP',
|
||||||
|
:keepalived_priority => 49,
|
||||||
:keepalived_interface => 'eth0',
|
:keepalived_interface => 'eth0',
|
||||||
:keepalived_ipvs => ['10.0.0.1', '10.0.0.2'],
|
:keepalived_ipvs => ['10.0.0.1', '10.0.0.2'],
|
||||||
:keepalived_localhost_ip => '127.0.0.1',
|
:keepalived_localhost_ip => '127.0.0.1',
|
||||||
@@ -136,6 +139,7 @@ describe 'cloud::loadbalancer' do
|
|||||||
|
|
||||||
it 'configure vrrp_instance with BACKUP state' do
|
it 'configure vrrp_instance with BACKUP state' do
|
||||||
should contain_keepalived__instance('1').with({
|
should contain_keepalived__instance('1').with({
|
||||||
|
'priority' => '49',
|
||||||
'notify_master' => '"/etc/init.d/haproxy start"',
|
'notify_master' => '"/etc/init.d/haproxy start"',
|
||||||
'notify_backup' => '"/etc/init.d/haproxy stop"',
|
'notify_backup' => '"/etc/init.d/haproxy stop"',
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user