Debian Codegraph @

manifests/params.pp

raw
1 # @summary
2 # This is a container class holding default parameters for for haproxy class.
3 #
4 # @note
5 # Currently, only the Redhat family is supported, but this can be easily
6 # extended by changing package names and configuration file paths.
7 #
8 class haproxy::params {
9 $merge_options = true
10
11 $service_options = "ENABLED=1\n" # Only used by Debian.
12 $sysconfig_options = 'OPTIONS=""' #Only used by Redhat/CentOS etc
13
14 case $facts['os']['family'] {
15 'Archlinux', 'Debian', 'Redhat', 'Gentoo', 'Suse', 'Linux' : {
16 $package_name = 'haproxy'
17 $service_name = 'haproxy'
18 $global_options = {
19 'log' => "${facts['networking']['ip']} local0",
20 'chroot' => '/var/lib/haproxy',
21 'pidfile' => '/var/run/haproxy.pid',
22 'maxconn' => '4000',
23 'user' => 'haproxy',
24 'group' => 'haproxy',
25 'daemon' => '',
26 'stats' => 'socket /var/lib/haproxy/stats',
27 }
28 $defaults_options = {
29 'log' => 'global',
30 'option' => ['redispatch'],
31 'retries' => '3',
32 'timeout' => [
33 'http-request 10s',
34 'queue 1m',
35 'connect 10s',
36 'client 1m',
37 'server 1m',
38 'check 10s',
39 ],
40 'maxconn' => '8000',
41 }
42 $config_validate_cmd = '/usr/sbin/haproxy -f % -c'
43 # Single instance:
44 $config_dir = '/etc/haproxy'
45 $config_file = '/etc/haproxy/haproxy.cfg'
46 $manage_config_dir = true
47 # Multi-instance:
48 $config_dir_tmpl = '/etc/<%= @instance_name %>'
49 $config_file_tmpl = "${config_dir_tmpl}/<%= @instance_name %>.cfg"
50 }
51 'FreeBSD': {
52 $package_name = 'haproxy'
53 $service_name = 'haproxy'
54 $global_options = {
55 'log' => [
56 '127.0.0.1 local0',
57 '127.0.0.1 local1 notice',
58 ],
59 'chroot' => '/usr/local/haproxy',
60 'pidfile' => '/var/run/haproxy.pid',
61 'maxconn' => '4096',
62 'daemon' => '',
63 }
64 $defaults_options = {
65 'log' => 'global',
66 'mode' => 'http',
67 'option' => [
68 'httplog',
69 'dontlognull',
70 ],
71 'retries' => '3',
72 'redispatch' => '',
73 'maxconn' => '2000',
74 'contimeout' => '5000',
75 'clitimeout' => '50000',
76 'srvtimeout' => '50000',
77 }
78 $config_validate_cmd = '/usr/local/sbin/haproxy -f % -c'
79 # Single instance:
80 $config_dir = '/usr/local/etc'
81 $config_file = '/usr/local/etc/haproxy.conf'
82 $manage_config_dir = false
83 # Multi-instance:
84 $config_dir_tmpl = '/usr/local/etc/<%= @instance_name %>'
85 $config_file_tmpl = "${config_dir_tmpl}/<%= @instance_name %>.conf"
86 }
87 default: { fail("The ${facts['os']['family']} operating system is not supported with the haproxy module") }
88 }
89 }
90
91 # TODO: test that the $config_file generated for FreeBSD instances
92 # and RedHat instances is as expected.