File: haproxy.pp

package info (click to toggle)
openstack-cluster-installer 43.0.18
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,484 kB
  • sloc: php: 19,127; sh: 18,142; ruby: 75; makefile: 31; xml: 8
file content (57 lines) | stat: -rw-r--r-- 1,604 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Creates the haproxy front-end and back-end for a MariaDB galera cluster
#
# == Parameters
#
# [*sql_vip_ip*]
#   (required) IP address of the virtual IP used to connect to MariaDB
#
# [*first_sql*]
#   (required) Hostname of the non-backup SQL node
#
# [*first_sql_ip*]
#   (required) IP address of the non-backup SQL node
#
# [*non_master_sql*]
#   (required) Hostnames of the backup SQL nodes
#
# [*non_master_sql_ip*]
#   (required) IP addresses of the backup SQL nodes
#
class oci::sql::haproxy(
  $sql_vip_ip        = undef,
  $machine_hostname  = undef,
  $machine_ip        = undef,
  $non_master_sql    = undef,
  $non_master_sql_ip = undef,
){
  haproxy::frontend { 'galerafe':
    mode      => 'tcp',
    bind      => { "${sql_vip_ip}:3306" => [] },
    options   => [
      { 'timeout'         => 'client 3600s'},
      { 'default_backend' => 'galerabe'},
    ],
  }

  haproxy::backend { 'galerabe':
    options => [
       { 'mode'    => 'tcp' },
       { 'balance' => 'roundrobin' },
       { 'timeout' => 'check 5000' },
       { 'timeout' => 'server 3600s' },
       { 'option'  => 'httpchk'},
    ],
  }
  haproxy::balancermember { 'galerabm':
    listening_service => 'galerabe',
    ipaddresses       => $machine_ip,
    server_names      => $machine_hostname,
    options           => 'check inter 4000 port 9200 fall 3 rise 5',
  }
  haproxy::balancermember { 'galerabmback':
    listening_service => 'galerabe',
    ipaddresses       => $non_master_sql_ip,
    server_names      => $non_master_sql,
    options           => 'check inter 4000 port 9200 fall 3 rise 5 backup',
  }
}