aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYanis Guenane <yanis.guenane@enovance.com>2015-04-02 08:48:31 +0200
committerYanis Guenane <yanis.guenane@enovance.com>2015-04-07 11:53:54 +0200
commit72e8834efa188ecef879e5ae3141428b6a88f0a5 (patch)
tree1f8f0bd743686b42a07d27a9f9953e5941fc37bf
parent6f5c208f8df4df034637acd1b5fd6f4b71012d8a (diff)
Rethink the backup option for Galera
Initial logic for the backup option in the HAProxy was wrong and wouldn't do what expected. Current logic is implemented as follow 1. User passes an array of Galera IP addresses 2. User passes an array of Galera hostnames 3. User passes a Galera master IP and Galera master hostname Result : * Set a backend line with Galera master IP and Galera master hostname * Remove those data from the two arrays of IP and Hostnames * Set backend lines for whatever is left on those array with the backup option on Change-Id: Idfd72de4fafdce2a9c16945961fee996a98049b7
-rw-r--r--manifests/loadbalancer.pp27
1 files changed, 19 insertions, 8 deletions
diff --git a/manifests/loadbalancer.pp b/manifests/loadbalancer.pp
index 1d60507..ccc9d25 100644
--- a/manifests/loadbalancer.pp
+++ b/manifests/loadbalancer.pp
@@ -58,6 +58,10 @@
# FQDN of the Galera master node
# Defaults to undef
#
+# [*galera_master_ip*]
+# IP of the Galera master node
+# Defaults to undef
+#
# [*keystone_admin*]
# (optional) Enable or not Keystone Admin API binding
# Defaults to false
@@ -139,6 +143,7 @@ class tripleo::loadbalancer (
$controller_hosts = undef,
$controller_hosts_names = undef,
$galera_master_hostname = undef,
+ $galera_master_ip = undef,
$keystone_admin = false,
$keystone_public = false,
$neutron = false,
@@ -540,17 +545,23 @@ class tripleo::loadbalancer (
},
collect_exported => false,
}
- if downcase($galera_master_hostname) == $::hostname or !$galera_master_hostname {
- $options_real = ['check', 'inter 2000', 'rise 2', 'fall 5']
- } else {
- $options_real = ['check', 'inter 2000', 'rise 2', 'fall 5', 'backup']
- }
+
haproxy::balancermember { 'mysql':
listening_service => 'mysql',
ports => '3306',
- ipaddresses => $controller_hosts_real,
- server_names => $controller_hosts_names_real,
- options => $options_real,
+ ipaddresses => $galera_master_ip,
+ server_names => $galera_master_hostname,
+ options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
+ }
+
+ $controller_hosts_without_galera_master = delete($controller_hosts_real, $galera_master_ip)
+ $controller_hosts_names_without_galera_master = delete($controller_hosts_names_real, downcase($galera_master_hostname))
+ haproxy::balancermember { 'mysql-backup':
+ listening_service => 'mysql',
+ ports => '3306',
+ ipaddresses => $controller_hosts_without_galera_master,
+ server_names => $controller_hosts_names_without_galera_master,
+ options => ['check', 'inter 2000', 'rise 2', 'fall 5', 'backup'],
}
}