procmail: Support OpenBSD, add content parameter for procmail::rc

This commit is contained in:
Ossi Salmi 2013-07-28 20:16:00 +03:00
parent 3ae7a48fe9
commit 0b7dca59d3

View file

@ -1,4 +1,3 @@
# Install procmail # Install procmail
# #
class procmail { class procmail {
@ -14,7 +13,10 @@ class procmail {
recurse => true, recurse => true,
mode => "0755", mode => "0755",
owner => "root", owner => "root",
group => "root", group => $::operatingsystem ? {
"openbsd" => "wheel",
default => "root",
},
source => "puppet:///modules/custom/empty", source => "puppet:///modules/custom/empty",
require => Package["procmail"], require => Package["procmail"],
notify => Exec["generate-procmailrc"], notify => Exec["generate-procmailrc"],
@ -24,7 +26,10 @@ class procmail {
ensure => present, ensure => present,
mode => "0644", mode => "0644",
owner => "root", owner => "root",
group => "root", group => $::operatingsystem ? {
"openbsd" => "wheel",
default => "root",
},
require => Package["procmail"], require => Package["procmail"],
} }
@ -36,6 +41,7 @@ class procmail {
} }
# Add config file to procmail # Add config file to procmail
# #
# === Parameters # === Parameters
@ -44,6 +50,8 @@ class procmail {
# Config file name. # Config file name.
# $source: # $source:
# Config file source. Defaults to "puppet:///files/procmail/$name". # Config file source. Defaults to "puppet:///files/procmail/$name".
# $content:
# Config file content.
# #
# === Sample usage # === Sample usage
# #
@ -51,18 +59,28 @@ class procmail {
# source => "/etc/mail/spamassassin/spamassassin-spamc.rc", # source => "/etc/mail/spamassassin/spamassassin-spamc.rc",
# } # }
# #
define procmail::rc($source = "AUTO") { define procmail::rc($source="AUTO", $content=undef) {
file { "/etc/procmailrc.d/${name}": if $content {
ensure => present, $source_real = undef
source => $source ? { } else {
$source_real = $source ? {
"AUTO" => "puppet:///files/procmail/${name}", "AUTO" => "puppet:///files/procmail/${name}",
default => $source, default => $source,
}
}
file { "/etc/procmailrc.d/${name}":
ensure => present,
mode => "0644",
owner => "root",
group => $::operatingsystem ? {
"openbsd" => "wheel",
default => "root",
}, },
mode => "0644", content => $content,
owner => root, source => $source_real,
group => root, notify => Exec["generate-procmailrc"],
notify => Exec["generate-procmailrc"],
} }
} }