blob: 44cf2c809d8d56fa57c6c973c916d13277a35038 (
plain)
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
|
class root_mail {
package {['postfix', 'sendmail']:
ensure => absent,
}
package {'msmtp':}
if $facts['os']['family'] == "Debian" {
package {'msmtp-mta':}
}
$cron_service = case $facts['os']['family'] {
'Debian': { 'cron' }
'RedHat': { 'crond' }
default: { fail($facts['os']['family']) }
}
# if crond doesn't see /usr/bin/sendmail on startup, it won't send mails
Package['msmtp']
~>
service{$cron_service:
ensure => running,
}
if($facts['os']['family'] == 'RedHat') {
if($facts['os']['release']['major'] == '9') {
package {'s-nail':}
}
else {
package {'mailx':}
}
}
$host = lookup('mail.ses_endpoint')
$user = lookup('mail.ses_username')
$password = lookup('mail.ses_password')
$from = join([$facts['networking']['fqdn'], "@", lookup('mail.ses_domain')])
file {'/etc/msmtprc':
content => @("EOT")
defaults
tls on
tls_starttls on
tls_trust_file system
syslog on
account default
host $host
port 587
auth on
user $user
password $password
from $from
allow_from_override off
undisclosed_recipients on
set_from_header on
aliases /etc/aliases
| EOT
,
}
$root_mail = lookup('mail.root_mail')
file {'/etc/aliases':
content => @("EOT")
default: $root_mail
| EOT
,
}
}
|