Skip to content
Snippets Groups Projects
Commit 10d8dfdd authored by Giovanni Zizzi's avatar Giovanni Zizzi
Browse files

added programmatic haproxy balancermember configuration

parent 8b0e995b
No related branches found
No related tags found
3 merge requests!8Development,!6Rhmk ha,!4Dev rhmk
......@@ -7,13 +7,30 @@ Exec {
#node /^ocp-ubuntu\d+.cnaf.infn.it/ {
# include 'iaas::role::rhmk'
#}
node 'ocp-ubuntu15.cnaf.infn.it' {
class {'iaas::role::rhmk':
percona_master => true,
# percona_master => true,
keepalived_state => 'MASTER',
keepalived_priority => 150,
ha_servers => {
priority_hostname => 'ocp-ubuntu15',
priority_ip => '131.154.100.160',
hostnames => ['ocp-ubuntu16', 'ocp-ubuntu17'],
ips => ['131.154.100.164', '131.154.100.164'],
},
}
}
node 'ocp-ubuntu16.cnaf.infn.it', 'ocp-ubuntu17.cnaf.infn.it' {
include 'iaas::role::rhmk'
class {'iaas::role::rhmk':
keepalived_state => 'BACKUP',
keepalived_priority => 100,
ha_servers => {
priority_hostname => 'ocp-ubuntu15',
priority_ip => '131.154.100.160',
hostnames => ['ocp-ubuntu16', 'ocp-ubuntu17'],
ips => ['131.154.100.164', '131.154.100.164'],
},
}
}
......@@ -5,6 +5,7 @@ class iaas::profile::haproxy (
$stats_login = undef,
$stats_password = undef,
$stats_uri = undef,
$servers = undef,
) {
class { '::haproxy':
defaults_options => {
......@@ -56,15 +57,23 @@ class iaas::profile::haproxy (
'balance' => 'leastconn',
}
}
haproxy::balancermember { 'percona_cluster_bm':
listening_service => 'percona_cluster',
ports => '3307',
server_names => hiera('iaas::role::haproxy::servers', undef),
ipaddresses => hiera('iaas::role::haproxy::ipaddresses_server', undef),
options => 'check port 9200',
if $servers != undef {
haproxy::balancermember { 'percona_cluster_prior':
listening_service => 'percona_cluster',
ports => '3307',
server_names => $servers[priority_hostname],
ipaddresses => $servers[priority_ip],
options => 'check port 9200',
}
haproxy::balancermember { 'percona_cluster_secondaries':
listening_service => 'percona_cluster',
ports => '3307',
server_names => $servers[hostnames],
ipaddresses => $servers[ips],
options => 'check port 9200 backup',
}
}
# haproxy::listen { 'rabbitmq':
# ipaddress => '0.0.0.0',
# mode => 'tcp',
......
......@@ -2,13 +2,16 @@ class iaas::role::rhmk(
$percona_master = false,
$keepalived_priority = 100,
$keepalived_state = 'BACKUP',
$ha_servers = undef,
) {
# Base
class { 'iaas::profile::base': } ->
class { 'iaas::profile::database':
percona_master => $percona_master,
}->
class { 'iaas::profile::haproxy': }
class { 'iaas::profile::haproxy':
servers => $ha_servers,
}
class { 'iaas::profile::keepalived':
state => $keepalived_state,
priority => $keepalived_priority,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment