-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathinit.pp
More file actions
78 lines (70 loc) · 2.67 KB
/
init.pp
File metadata and controls
78 lines (70 loc) · 2.67 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Haproxy
class eit_haproxy (
Hash $service_options,
String $defaults_file_path,
Enum['auto', 'manual'] $configure,
Eit_haproxy::Domains $domains,
Eit_haproxy::Listen $listens,
Eit_haproxy::Timeout $frontend_timeout,
Hash[Eit_types::IP,Variant[
Array[Stdlib::Port],
Stdlib::Port
]] $firewall,
Optional[String] $restart_command,
Optional[String] $manual_config,
Boolean $ddos_protection = false,
Boolean $https = true,
Boolean $http = false,
Boolean $use_hsts = true,
Boolean $use_lets_encrypt = true,
Enum['http','tcp'] $mode = 'http',
Array[Stdlib::IP::Address,1] $listen_on = ['0.0.0.0'],
Enum['Modern','Intermediate'] $encryption_ciphers = 'Modern',
Eit_types::Package_version $version = 'present',
Eit_types::Service_Ensure $service_ensure = true,
Eit_types::Service_Enable $service_enable = true,
String $service_name = 'haproxy',
Boolean $log_compressed = false,
Stdlib::Absolutepath $log_dir = '/var/log',
) {
if $configure == 'manual' {
contain eit_haproxy::install
contain eit_haproxy::service
class { 'eit_haproxy::manual_config':
config_file => $manual_config,
}
}
if $configure == 'auto' {
# NOTE: Needed this, we install our own haproxy 2.9 on centos7
if versioncmp($facts.dig('haproxy_version'), '2.5.0') >= 0 {
$_service = @(EOT)
[Service]
ExecStartPre=
ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q
| EOT
systemd::dropin_file { 'haproxy_dropin':
filename => 'haproxy-override.conf',
unit => 'haproxy.service',
content => $_service,
notify => Service['haproxy'],
}
}
class { 'eit_haproxy::basic_config':
domains => $domains,
ddos_protection => $ddos_protection,
https => $https,
http => $http,
use_hsts => $use_hsts,
use_lets_encrypt => $use_lets_encrypt,
listens => $listens,
mode => $mode,
listen_on => $listen_on,
frontend_timeout => $frontend_timeout,
encryption_ciphers => $encryption_ciphers,
}
}
# Setup Firewall Rules
contain eit_haproxy::firewall
# Setup logs to send it to rsyslog
contain eit_haproxy::log
}