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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#########################################################################
#
# This class provides a basic setup of postfix with local and remote
# delivery and an SMTP server listening on the loopback interface.
#
class postfix {
# Default value for various options
case $postfix_ng_smtp_listen {
"": { $postfix_ng_smtp_listen = "127.0.0.1" }
}
case $root_mail_recipient {
"": { $root_mail_recipient = "nobody" }
}
package { ["postfix", "mailx"]:
ensure => installed
}
service { "postfix":
ensure => running,
require => Package["postfix"],
}
file { "/etc/mailname":
ensure => present,
content => "${fqdn}\n",
seltype => "postfix_etc_t",
}
# Aliases
file { "/etc/aliases":
ensure => present,
content => "# file managed by puppet\n",
replace => false,
seltype => "postfix_etc_t",
notify => Exec["newaliases"],
}
exec { "newaliases":
command => "/usr/bin/newaliases",
refreshonly => true,
require => Package["postfix"],
subscribe => File["/etc/aliases"],
}
# Config files
file { "/etc/postfix/master.cf":
ensure => present,
content => $operatingsystem ? {
Redhat => template("postfix/master.cf.redhat5.erb"),
Debian => template("postfix/master.cf.debian-etch.erb"),
},
notify => Service["postfix"],
require => Package["postfix"],
}
file { "/etc/postfix/main.cf":
ensure => present,
source => "puppet:///postfix/main.cf",
replace => false,
notify => Service["postfix"],
require => Package["postfix"],
}
# Default configuration parameters
postfix::config {
"myorigin": value => "${fqdn}";
"alias_maps": value => "hash:/etc/aliases";
"inet_interfaces": value => "all";
}
case $operatingsystem {
RedHat: {
postfix::config {
"sendmail_path": value => "/usr/sbin/sendmail.postfix";
"newaliases_path": value => "/usr/bin/newaliases.postfix";
"mailq_path": value => "/usr/bin/mailq.postfix";
}
}
}
mailalias {"root":
recipient => $root_mail_recipient,
notify => Exec["newaliases"],
}
}
|