Make configuration of keepalived optional
Change-Id: I98b9b3dbc48009ce255d964ac580e1a31f279f1e
This commit is contained in:
parent
72e8834efa
commit
212a0fe9c4
|
@ -19,6 +19,10 @@
|
||||||
#
|
#
|
||||||
# === Parameters:
|
# === Parameters:
|
||||||
#
|
#
|
||||||
|
# [*enable_keepalived*]
|
||||||
|
# Whether to enable keepalived or not
|
||||||
|
# Defaults to true
|
||||||
|
#
|
||||||
# [*controller_host*]
|
# [*controller_host*]
|
||||||
# (Deprecated)Host or group of hosts to load-balance the services
|
# (Deprecated)Host or group of hosts to load-balance the services
|
||||||
# Can be a string or an array.
|
# Can be a string or an array.
|
||||||
|
@ -135,6 +139,7 @@
|
||||||
# Defaults to false
|
# Defaults to false
|
||||||
#
|
#
|
||||||
class tripleo::loadbalancer (
|
class tripleo::loadbalancer (
|
||||||
|
$enable_keepalived = true,
|
||||||
$controller_virtual_ip,
|
$controller_virtual_ip,
|
||||||
$control_virtual_interface,
|
$control_virtual_interface,
|
||||||
$public_virtual_interface,
|
$public_virtual_interface,
|
||||||
|
@ -180,44 +185,46 @@ class tripleo::loadbalancer (
|
||||||
$controller_hosts_names_real = $controller_hosts_names
|
$controller_hosts_names_real = $controller_hosts_names
|
||||||
}
|
}
|
||||||
|
|
||||||
case $::osfamily {
|
if $enable_keepalived {
|
||||||
'RedHat': {
|
case $::osfamily {
|
||||||
$keepalived_name_is_process = false
|
'RedHat': {
|
||||||
$keepalived_vrrp_script = 'systemctl status haproxy.service'
|
$keepalived_name_is_process = false
|
||||||
} # RedHat
|
$keepalived_vrrp_script = 'systemctl status haproxy.service'
|
||||||
'Debian': {
|
} # RedHat
|
||||||
$keepalived_name_is_process = true
|
'Debian': {
|
||||||
$keepalived_vrrp_script = undef
|
$keepalived_name_is_process = true
|
||||||
|
$keepalived_vrrp_script = undef
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
warning('Please configure keepalived defaults in tripleo::loadbalancer.')
|
||||||
|
$keepalived_name_is_process = undef
|
||||||
|
$keepalived_vrrp_script = undef
|
||||||
|
}
|
||||||
}
|
}
|
||||||
default: {
|
|
||||||
warning('Please configure keepalived defaults in tripleo::loadbalancer.')
|
class { '::keepalived': }
|
||||||
$keepalived_name_is_process = undef
|
keepalived::vrrp_script { 'haproxy':
|
||||||
$keepalived_vrrp_script = undef
|
name_is_process => $keepalived_name_is_process,
|
||||||
|
script => $keepalived_vrrp_script,
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
class { '::keepalived': }
|
# KEEPALIVE INSTANCE CONTROL
|
||||||
keepalived::vrrp_script { 'haproxy':
|
keepalived::instance { '51':
|
||||||
name_is_process => $keepalived_name_is_process,
|
interface => $control_virtual_interface,
|
||||||
script => $keepalived_vrrp_script,
|
virtual_ips => [join([$controller_virtual_ip, ' dev ', $control_virtual_interface])],
|
||||||
}
|
state => 'MASTER',
|
||||||
|
track_script => ['haproxy'],
|
||||||
|
priority => 101,
|
||||||
|
}
|
||||||
|
|
||||||
# KEEPALIVE INSTANCE CONTROL
|
# KEEPALIVE INSTANCE PUBLIC
|
||||||
keepalived::instance { '51':
|
keepalived::instance { '52':
|
||||||
interface => $control_virtual_interface,
|
interface => $public_virtual_interface,
|
||||||
virtual_ips => [join([$controller_virtual_ip, ' dev ', $control_virtual_interface])],
|
virtual_ips => [join([$public_virtual_ip, ' dev ', $public_virtual_interface])],
|
||||||
state => 'MASTER',
|
state => 'MASTER',
|
||||||
track_script => ['haproxy'],
|
track_script => ['haproxy'],
|
||||||
priority => 101,
|
priority => 101,
|
||||||
}
|
}
|
||||||
|
|
||||||
# KEEPALIVE INSTANCE PUBLIC
|
|
||||||
keepalived::instance { '52':
|
|
||||||
interface => $public_virtual_interface,
|
|
||||||
virtual_ips => [join([$public_virtual_ip, ' dev ', $public_virtual_interface])],
|
|
||||||
state => 'MASTER',
|
|
||||||
track_script => ['haproxy'],
|
|
||||||
priority => 101,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sysctl::value { 'net.ipv4.ip_nonlocal_bind': value => '1' }
|
sysctl::value { 'net.ipv4.ip_nonlocal_bind': value => '1' }
|
||||||
|
|
Loading…
Reference in New Issue