Added postfix module
This commit is contained in:
parent
b64f7ea19a
commit
8bcdebc69e
4 changed files with 851 additions and 0 deletions
105
postfix/manifests/init.pp
Normal file
105
postfix/manifests/init.pp
Normal file
|
@ -0,0 +1,105 @@
|
|||
# Install Postfix packages.
|
||||
#
|
||||
class postfix {
|
||||
|
||||
include ssl
|
||||
|
||||
if !$postfix_key {
|
||||
$postfix_key = "${puppet_ssldir}/private_keys/${homename}.pem"
|
||||
}
|
||||
if !$postfix_cert {
|
||||
$postfix_cert = "${puppet_ssldir}/certs/${homename}.pem"
|
||||
}
|
||||
|
||||
if !$mail_domain {
|
||||
if $domain {
|
||||
$mail_domain = $domain
|
||||
} else {
|
||||
fail("Failed to set \$mail_domain, missing \$domain")
|
||||
}
|
||||
}
|
||||
|
||||
if !$postfix_hostname {
|
||||
if $fqdn {
|
||||
$postfix_hostname = $fqdn
|
||||
} else {
|
||||
fail("Failed to set \$postfix_hostname, missing \$fqdn")
|
||||
}
|
||||
}
|
||||
|
||||
if !$postfix_interfaces {
|
||||
$postfix_interfaces = "localhost"
|
||||
}
|
||||
|
||||
package { "postfix":
|
||||
ensure => installed,
|
||||
}
|
||||
|
||||
service { "postfix":
|
||||
ensure => running,
|
||||
enable => true,
|
||||
require => Package["postfix"],
|
||||
}
|
||||
|
||||
file { "${ssl::certs}/postfix.crt":
|
||||
ensure => present,
|
||||
source => $postfix_cert,
|
||||
mode => "0644",
|
||||
owner => "root",
|
||||
group => "root",
|
||||
notify => Service["postfix"],
|
||||
}
|
||||
file { "${ssl::private}/postfix.key":
|
||||
ensure => present,
|
||||
source => $postfix_key,
|
||||
mode => "0600",
|
||||
owner => "root",
|
||||
group => "root",
|
||||
notify => Service["postfix"],
|
||||
}
|
||||
|
||||
file { "/etc/postfix/main.cf":
|
||||
ensure => present,
|
||||
mode => "0644",
|
||||
owner => "root",
|
||||
group => "root",
|
||||
content => template("postfix/main.cf.erb"),
|
||||
notify => Service["postfix"],
|
||||
require => Package["postfix"],
|
||||
}
|
||||
|
||||
file { "/etc/aliases":
|
||||
ensure => present,
|
||||
source => [
|
||||
"puppet:///files/mail/aliases.${homename}",
|
||||
"puppet:///files/mail/aliases",
|
||||
"puppet:///modules/postfix/aliases",
|
||||
],
|
||||
mode => "0644",
|
||||
owner => "root",
|
||||
group => "root",
|
||||
notify => Exec["newaliases"],
|
||||
}
|
||||
exec { "newaliases":
|
||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||
refreshonly => true,
|
||||
}
|
||||
|
||||
file { "/etc/postfix/virtual":
|
||||
ensure => present,
|
||||
source => [
|
||||
"puppet:///files/mail/virtual.${homename}",
|
||||
"puppet:///files/mail/virtual",
|
||||
"puppet:///modules/postfix/empty",
|
||||
],
|
||||
mode => "0644",
|
||||
owner => "root",
|
||||
group => "root",
|
||||
notify => Exec["postmap /etc/postfix/virtual"],
|
||||
}
|
||||
exec { "postmap /etc/postfix/virtual":
|
||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||
refreshonly => true,
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue