summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-01-25 14:03:24 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-01-25 14:03:24 -0200
commit8b78b15e57c4b802be46c540a16be42fd23435f5 (patch)
tree7f5b17dcf1da2de3626d3105c961534b16c1db87 /manifests
parent5e806b99e2448dfb4bcd880b3c77578e1a15c8aa (diff)
Switching to parametrized classes
Diffstat (limited to 'manifests')
-rw-r--r--manifests/config.pp2
-rw-r--r--manifests/hash.pp2
-rw-r--r--manifests/header_checks_snippet.pp2
-rw-r--r--manifests/init.pp103
-rw-r--r--manifests/mailalias.pp2
-rw-r--r--manifests/mailman.pp10
-rw-r--r--manifests/mta.pp31
-rw-r--r--manifests/satellite.pp24
-rw-r--r--manifests/tlspolicy.pp13
-rw-r--r--manifests/tlspolicy_snippet.pp5
-rw-r--r--manifests/transport.pp2
-rw-r--r--manifests/transport_regexp.pp5
-rw-r--r--manifests/transport_regexp_snippet.pp2
-rw-r--r--manifests/virtual.pp2
-rw-r--r--manifests/virtual_regexp.pp5
-rw-r--r--manifests/virtual_regexp_snippet.pp2
16 files changed, 116 insertions, 96 deletions
diff --git a/manifests/config.pp b/manifests/config.pp
index 8e203a6..ce7af9e 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -18,7 +18,7 @@ Example usage:
node "toto.example.com" {
- include postfix
+ class { 'postfix': }
postfix::config {
"smtp_use_tls" => "yes";
diff --git a/manifests/hash.pp b/manifests/hash.pp
index 6e2012f..006f881 100644
--- a/manifests/hash.pp
+++ b/manifests/hash.pp
@@ -17,7 +17,7 @@ Example usage:
node "toto.example.com" {
- include postfix
+ class { 'postfix': }
postfix::hash { "/etc/postfix/virtual":
ensure => present,
diff --git a/manifests/header_checks_snippet.pp b/manifests/header_checks_snippet.pp
index 91d7501..05929a3 100644
--- a/manifests/header_checks_snippet.pp
+++ b/manifests/header_checks_snippet.pp
@@ -14,7 +14,7 @@ Requires:
Example usage:
node "toto.example.com" {
- include postfix
+ class { 'postfix': }
postfix::header_checks_snippet {
'wrong_date': content => 'FIXME';
'bla': source => 'puppet:///files/etc/postfix/header_checks.d/bla';
diff --git a/manifests/init.pp b/manifests/init.pp
index 5b04a0f..20b04f4 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -5,17 +5,55 @@
# delivery and an SMTP server listening on the loopback interface.
#
# Parameters:
-# - *$postfix_smtp_listen*: address on which the smtp service will listen to. defaults to 127.0.0.1
+# - *$smtp_listen*: address on which the smtp service will listen to. defaults to 127.0.0.1
# - *$root_mail_recipient*: who will recieve root's emails. defaults to "nobody"
+# - *$anon_sasl*: set $anon_sasl="yes" to hide the originating IP in email
+# - *$manage_header_checks*: manage header checks
+# - *$manage_tls_policy*: manage tls policy
+# - *$manage_transport_regexp*: manage transport regexps
+# - *$manage_virtual_regexp*: manage virtual regexps
+# - *$tls_fingerprint_digest*: fingerprint digest for tls policy class
+# - *$use_amavisd*: set to "yes" to configure amavis
+# - *$use_dovecot_lda*: include dovecot declaration at master.cf
+# - *$use_schleuder*: whether to include schleuder portion at master.cf
+# - *$use_sympa*: whether to include sympa portion at master.cf
+# - *$use_firma*: whether to include firma portion at master.cf
+# - *$use_mlmmj*: whether to include mlmmj portion at master.cf
+# - *$use_submission*: set to "yes" to enable submission section at master.cf
+# - *$use_smtps*: set to "yes" to enable smtps section at master.cf
+# - *$mastercf_tail*: set this for additional content to be added at the end of master.cf
+# - *$inet_interfaces*: which inet interface postfix should listen on
+# - *$myorigin*: sets postfix $myorigin configuration
#
# Example usage:
#
# node "toto.example.com" {
-# $postfix_smtp_listen = "192.168.1.10"
-# include postfix
+# class { 'postfix':
+# smtp_listen => "192.168.1.10"
+# }
# }
#
-class postfix {
+class postfix(
+ $smtp_listen = "127.0.0.1",
+ $root_mail_recipient = "nobody",
+ $anon_sasl = "no",
+ $manage_header_checks = "no",
+ $manage_tls_policy = "no",
+ $manage_transport_regexp = "no",
+ $manage_virtual_regexp = "no",
+ $tls_fingerprint_digest = 'sha1'
+ $use_amavisd = "no",
+ $use_dovecot_lda = "no",
+ $use_schleuder = "no",
+ $use_sympa = "no",
+ $use_firma = "no",
+ $use_mlmmj = "no",
+ $use_submission = "no",
+ $use_smtps = "no",
+ $mastercf_tail = "",
+ $inet_interfaces = 'all',
+ $myorigin = $::fqdn
+) {
# selinux labels differ from one distribution to another
case $::operatingsystem {
@@ -33,65 +71,30 @@ class postfix {
}
}
- # Default value for various options
- case $postfix_smtp_listen {
- "": { $postfix_smtp_listen = "127.0.0.1" }
- }
- case $root_mail_recipient {
- "": { $root_mail_recipient = "nobody" }
- }
- case $postfix_anon_sasl {
- "": { $postfix_anon_sasl = "no" }
- }
- case $postfix_manage_header_checks {
- "": { $postfix_manage_header_checks = "no" }
- }
- case $postfix_manage_tls_policy {
- "": { $postfix_manage_tls_policy = "no" }
- }
- case $postfix_use_amavisd {
- "": { $postfix_use_amavisd = "no" }
- }
- case $postfix_use_dovecot_lda {
- "": { $postfix_use_dovecot_lda = "no" }
- }
- case $postfix_use_schleuder {
- "": { $postfix_use_schleuder = "no" }
- }
- case $postfix_use_sympa {
- "": { $postfix_use_sympa = "no" }
- }
- case $postfix_mastercf_tail {
- "": { $postfix_mastercf_tail = "" }
- }
- case $postfix_inet_interfaces {
- "": { $postfix_inet_interfaces = 'all' }
- }
- case $postfix_myorigin {
- "": { $postfix_myorigin = $fqdn }
- }
# Bootstrap moduledir
include common::moduledir
module_dir{'postfix': }
# Include optional classes
- if $postfix_anon_sasl == 'yes' {
+ if $anon_sasl == 'yes' {
include postfix::anonsasl
}
- if $postfix_manage_header_checks == 'yes' {
+ if $header_checks == 'yes' {
include postfix::header_checks
}
- if $postfix_manage_tls_policy == 'yes' {
- include postfix::tlspolicy
+ if $manage_tls_policy == 'yes' {
+ class { 'postfix::tlspolicy':
+ fingerprint_digest => $tls_fingerprint_digest,
+ }
}
- if $postfix_use_amavisd == 'yes' {
+ if $use_amavisd == 'yes' {
include postfix::amavis
}
- if $postfix_manage_transport_regexp == 'yes' {
+ if $manage_transport_regexp == 'yes' {
include postfix::transport_regexp
}
- if $postfix_manage_virtual_regexp == 'yes' {
+ if $manage_virtual_regexp == 'yes' {
include postfix::virtual_regexp
}
@@ -163,9 +166,9 @@ class postfix {
# Default configuration parameters
postfix::config {
- "myorigin": value => "${postfix_myorigin}";
+ "myorigin": value => "${myorigin}";
"alias_maps": value => "hash:/etc/aliases";
- "inet_interfaces": value => "${postfix_inet_interfaces}";
+ "inet_interfaces": value => "${inet_interfaces}";
}
case $::operatingsystem {
diff --git a/manifests/mailalias.pp b/manifests/mailalias.pp
index cd1af50..2f239ac 100644
--- a/manifests/mailalias.pp
+++ b/manifests/mailalias.pp
@@ -15,7 +15,7 @@ Example usage:
node "toto.example.com" {
- include postfix
+ class { 'postfix': }
postfix::mailalias { "postmaster":
ensure => present,
diff --git a/manifests/mailman.pp b/manifests/mailman.pp
index cba0848..8c6ee32 100644
--- a/manifests/mailman.pp
+++ b/manifests/mailman.pp
@@ -4,19 +4,17 @@
# Configures a basic smtp server, able to work for the mailman mailing-list
# manager.
#
-# Parameters:
-# - every global variable which works for class "postfix" will work here.
-#
# Example usage:
#
# node "toto.example.com" {
# include mailman
-# include postfix::mailman
+# class { 'postfix::mailman': }
# }
#
class postfix::mailman {
- $postfix_smtp_listen = "0.0.0.0"
- include postfix
+ class { 'postfix':
+ smtp_listen => "0.0.0.0",
+ }
postfix::config {
"mydestination": value => "";
diff --git a/manifests/mta.pp b/manifests/mta.pp
index c36c0bc..f7a865d 100644
--- a/manifests/mta.pp
+++ b/manifests/mta.pp
@@ -15,14 +15,21 @@
# - *$postfix_mydestination*
# - every global variable which works for class "postfix" will work here.
#
+# Requires:
+# - Class["postfix"]
+#
# Example usage:
#
# node "toto.example.com" {
-# $postfix_relayhost = "mail.example.com"
-# $postfix_smtp_listen = "0.0.0.0"
-# $postfix_mydestination = "\$myorigin, myapp.example.com"
#
-# include postfix::mta
+# class { 'postfix':
+# smtp_listen => "0.0.0.0",
+# }
+#
+# class { 'postfix::mta':
+# relayhost => "mail.example.com",
+# mydestination => "\$myorigin, myapp.example.com",
+# }
#
# postfix::transport { "myapp.example.com":
# ensure => present,
@@ -30,22 +37,24 @@
# }
# }
#
-class postfix::mta {
+class postfix::mta(
+ $mydestination = '',
+ $relayhost = ''
+) {
- #case $postfix_relayhost {
- # "": { fail("Required \$postfix_relayhost variable is not defined.") }
+ #case $relayhost {
+ # "": { fail("Required relayhost parameter is not defined.") }
#}
- case $postfix_mydestination {
+ case $mydestination {
"": { $postfix_mydestination = "\$myorigin" }
+ default: { $postfix_mydestination = "$mydestination" }
}
- include postfix
-
postfix::config {
"mydestination": value => $postfix_mydestination;
"mynetworks": value => "127.0.0.0/8";
- "relayhost": value => $postfix_relayhost;
+ "relayhost": value => $relayhost;
"virtual_alias_maps": value => "hash:/etc/postfix/virtual";
"transport_maps": value => "hash:/etc/postfix/transport";
}
diff --git a/manifests/satellite.pp b/manifests/satellite.pp
index 99904dd..63fc466 100644
--- a/manifests/satellite.pp
+++ b/manifests/satellite.pp
@@ -14,14 +14,18 @@
# Example usage:
#
# node "toto.local.lan" {
-# $postfix_relayhost = "mail.example.com"
-# $valid_fqdn = "toto.example.com"
-# $root_mail_recipient = "the.sysadmin@example.com"
-#
-# include postfix::satellite
+# class { 'postfix::satellite':
+# relayhost => "mail.example.com"
+# valid_fqdn => "toto.example.com"
+# root_mail_recipient => "the.sysadmin@example.com"
+# }
# }
#
-class postfix::satellite {
+class postfix::satellite(
+ $relayhost = '',
+ $valid_fqdn = '',
+ $root_mail_recipient = ''
+) {
# If $valid_fqdn exists, use it to override $fqdn
case $valid_fqdn {
@@ -29,7 +33,13 @@ class postfix::satellite {
default: { $fqdn = "${valid_fqdn}" }
}
- include postfix::mta
+ class { 'postfix:
+ root_mail_recipient => $root_mail_recipient,
+ }
+
+ class { 'postfix::mta':
+ relayhost => $relayhost,
+ }
postfix::virtual {"@${valid_fqdn}":
ensure => present,
diff --git a/manifests/tlspolicy.pp b/manifests/tlspolicy.pp
index fb7020d..e1272b9 100644
--- a/manifests/tlspolicy.pp
+++ b/manifests/tlspolicy.pp
@@ -5,18 +5,15 @@
# via postfix::tlspolicy_snippet defines
#
# Parameters:
-# - $postfix_tls_fingerprint_digest (defaults to sha1)
+# - $fingerprint_digest (defaults to sha1)
#
# Note that this class is useless when used directly.
# The postfix::tlspolicy_snippet defines takes care of importing
# it anyway.
#
-class postfix::tlspolicy {
-
- # Default value for parameters
- case $postfix_tls_fingerprint_digest {
- "": { $postfix_tls_fingerprint_digest = 'sha1' }
- }
+class postfix::tlspolicy(
+ $fingerprint_digest = 'sha1'
+) {
include common::moduledir
module_dir{'postfix/tls_policy': }
@@ -37,7 +34,7 @@ class postfix::tlspolicy {
}
postfix::config {
- 'smtp_tls_fingerprint_digest': value => "$postfix_tls_fingerprint_digest";
+ 'smtp_tls_fingerprint_digest': value => "$fingerprint_digest";
}
postfix::config { 'smtp_tls_policy_maps':
diff --git a/manifests/tlspolicy_snippet.pp b/manifests/tlspolicy_snippet.pp
index 701528b..b63f812 100644
--- a/manifests/tlspolicy_snippet.pp
+++ b/manifests/tlspolicy_snippet.pp
@@ -16,8 +16,9 @@ Requires:
Example usage:
node "toto.example.com" {
- $postfix_manage_tls_policy = yes
- include postfix
+ class { 'postfix':
+ manage_tls_policy => 'yes',
+ }
postfix::tlspolicy_snippet {
'example.com': value => 'encrypt';
'.example.com': value => 'encrypt';
diff --git a/manifests/transport.pp b/manifests/transport.pp
index 5ca5554..90c5468 100644
--- a/manifests/transport.pp
+++ b/manifests/transport.pp
@@ -18,7 +18,7 @@ Example usage:
node "toto.example.com" {
- include postfix
+ class { 'postfix': }
postfix::hash { "/etc/postfix/transport":
ensure => present,
diff --git a/manifests/transport_regexp.pp b/manifests/transport_regexp.pp
index 924ae8a..7670d7d 100644
--- a/manifests/transport_regexp.pp
+++ b/manifests/transport_regexp.pp
@@ -11,8 +11,9 @@
# Example usage:
#
# node "toto.example.com" {
-# $postfix_manage_transport_regexp = yes
-# include postfix
+# class { 'postfix':
+# manage_transport_regexp => 'yes',
+# }
# postfix::config { "transport_maps":
# value => "hash:/etc/postfix/transport, regexp:/etc/postfix/transport_regexp",
# }
diff --git a/manifests/transport_regexp_snippet.pp b/manifests/transport_regexp_snippet.pp
index eb43c37..2b13ed1 100644
--- a/manifests/transport_regexp_snippet.pp
+++ b/manifests/transport_regexp_snippet.pp
@@ -14,7 +14,7 @@ Requires:
Example usage:
node "toto.example.com" {
- include postfix
+ class { 'postfix': }
postfix::transport_regexp {
'wrong_date': content => 'FIXME';
'bla': source => 'puppet:///files/etc/postfix/transport_regexp.d/bla';
diff --git a/manifests/virtual.pp b/manifests/virtual.pp
index 8fcd53a..d6912a4 100644
--- a/manifests/virtual.pp
+++ b/manifests/virtual.pp
@@ -18,7 +18,7 @@ Example usage:
node "toto.example.com" {
- include postfix
+ class { 'postfix': }
postfix::hash { "/etc/postfix/virtual":
ensure => present,
diff --git a/manifests/virtual_regexp.pp b/manifests/virtual_regexp.pp
index db41354..ece3117 100644
--- a/manifests/virtual_regexp.pp
+++ b/manifests/virtual_regexp.pp
@@ -11,8 +11,9 @@
# Example usage:
#
# node "toto.example.com" {
-# $postfix_manage_virtual_regexp = yes
-# include postfix
+# class { 'postfix':
+# manage_virtual_regexp => 'yes',
+# }
# postfix::config { "virtual_alias_maps":
# value => 'hash://postfix/virtual, regexp:/etc/postfix/virtual_regexp',
# }
diff --git a/manifests/virtual_regexp_snippet.pp b/manifests/virtual_regexp_snippet.pp
index b4515b4..bd9a982 100644
--- a/manifests/virtual_regexp_snippet.pp
+++ b/manifests/virtual_regexp_snippet.pp
@@ -14,7 +14,7 @@ Requires:
Example usage:
node "toto.example.com" {
- include postfix
+ class { 'postfix': }
postfix::virtual_regexp {
'wrong_date': content => 'FIXME';
'bla': source => 'puppet:///files/etc/postfix/virtual_regexp.d/bla';