Puppet Class: peadm::load_balancer

Defined in:
manifests/load_balancer.pp

Summary

Example class for PE compiler load balancer

Overview



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
58
59
60
61
# File 'manifests/load_balancer.pp', line 3

class peadm::load_balancer {

  class { 'haproxy':
    global_options   => {
      'log'     => "${::ipaddress} local2",
      'chroot'  => '/var/lib/haproxy',
      'pidfile' => '/var/run/haproxy.pid',
      'maxconn' => 5000,
      'user'    => 'haproxy',
      'group'   => 'haproxy',
      'daemon'  => '',
      'stats'   => 'socket /var/lib/haproxy/stats',
    },
    defaults_options => {
      'timeout' => [
        'connect 10s',
        'queue 1m',
        'client 2m',
        'server 2m',
        'http-request 120s',
      ]
    }
  }

  haproxy::listen { 'puppetserver':
    collect_exported => true,
    mode             => 'tcp',
    ipaddress        => $::ipaddress,
    ports            => '8140',
    options          => {
      option  => ['tcplog'],
      balance => 'leastconn',
    },
  }

  haproxy::listen { 'pcp-broker':
    collect_exported => true,
    mode             => 'tcp',
    ipaddress        => $::ipaddress,
    ports            => '8142',
    options          => {
      option  => ['tcplog'],
      balance => 'leastconn',
      timeout => [
        'tunnel 15m',
        'client-fin 30s',
      ],
    },
  }

  # TODO: split load balancing into two pools, A and B
  haproxy::listen { 'puppetdb':
    collect_exported => true,
    ipaddress        => $::ipaddress,
    ports            => '8081',
    options          => {},
  }

}