loadbalancer: allow to change HAproxy monitor VIP

Some use-cases require to be able to change a the VIP for HAproxy
monitor interface binding.
False by default to keep the Public VIP if not specified.

Change-Id: I48ae2039234baadffd5c921937fd33cc496f864c
This commit is contained in:
Emilien Macchi 2014-11-27 14:04:58 -05:00
parent 3ce0d9e3d3
commit d993558346
2 changed files with 22 additions and 1 deletions

View File

@ -184,6 +184,10 @@
# Should be part of keepalived_internal_ips
# Defaults to false (backward compatibility)
#
# [*vip_monitor_ip*]
# (optional) Array or string for monitor VIP
# Defaults to false
#
# [*firewall_settings*]
# (optional) Allow to add custom parameters to firewall rules
# Should be an hash.
@ -260,6 +264,7 @@ class cloud::loadbalancer(
$spice_port = 6082,
$vip_public_ip = ['127.0.0.1'],
$vip_internal_ip = false,
$vip_monitor_ip = false,
$galera_ip = ['127.0.0.1'],
$galera_slave = false,
$firewall_settings = {},
@ -357,8 +362,14 @@ class cloud::loadbalancer(
mode => '0644';
}
if $vip_monitor_ip {
$vip_monitor_ip_real = $vip_monitor_ip
} else {
$vip_monitor_ip_real = $vip_public_ip
}
haproxy::listen { 'monitor':
ipaddress => $vip_public_ip,
ipaddress => $vip_monitor_ip_real,
ports => '9300',
options => {
'mode' => 'http',

View File

@ -236,6 +236,16 @@ describe 'cloud::loadbalancer' do
)}
end # configure monitor haproxy listen
context 'configure monitor haproxy listen with another vip' do
before do
params.merge!( :vip_monitor_ip => ['192.168.0.1'] )
end
it { is_expected.to contain_haproxy__listen('monitor').with(
:ipaddress => ['192.168.0.1'],
:ports => '9300'
)}
end # configure monitor haproxy listen
context 'configure galera haproxy listen' do
it { is_expected.to contain_haproxy__listen('galera_cluster').with(
:ipaddress => params[:galera_ip],