puppet/sendmail/manifests/init.pp
2010-12-27 06:57:29 +02:00

84 lines
2 KiB
Puppet

# Install Sendmail packages.
#
class sendmail::common {
if !$mail_domain and $domain {
$mail_domain = $domain
}
case $operatingsystem {
centos,fedora: {
package { ["sendmail", "sendmail-cf"]:
ensure => installed,
}
}
}
}
# Configure Sendmail submission.
#
# === Global variables
#
# $mail_server:
# Hostname of mail server.
#
class sendmail::client inherits sendmail::common {
if !$mail_server {
$mail_server = "127.0.0.1"
}
case $operatingsystem {
openbsd: {
file { "/usr/share/sendmail/cf/submit.mc":
ensure => present,
content => template("sendmail/submit.mc.erb"),
owner => root,
group => bin,
mode => 0444,
notify => Exec["make submit.cf"],
}
}
default: {
file { "/etc/mail/submit.mc":
ensure => present,
content => template("sendmail/submit.mc.erb"),
owner => root,
group => root,
mode => 0644,
notify => Exec["make submit.cf"],
}
}
}
exec { "make submit.cf":
path => "/bin:/usr/bin:/sbin:/usr/sbin",
cwd => $operatingsystem ? {
openbsd => "/usr/share/sendmail/cf",
default => "/etc/mail",
},
require => $operatingsystem ? {
openbsd => undef,
default => Package["sendmail-cf"],
},
refreshonly => true,
}
file { "/etc/mail/submit.cf":
ensure => present,
owner => root,
group => $operatingsystem ? {
openbsd => wheel,
default => root,
},
mode => 0644,
source => $operatingsystem ? {
openbsd => "/usr/share/sendmail/cf/submit.cf",
default => undef,
},
require => Exec["make submit.cf"],
}
}