summaryrefslogtreecommitdiff
path: root/manifests/mta.pp
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/mta.pp
parent5e806b99e2448dfb4bcd880b3c77578e1a15c8aa (diff)
Switching to parametrized classes
Diffstat (limited to 'manifests/mta.pp')
-rw-r--r--manifests/mta.pp31
1 files changed, 20 insertions, 11 deletions
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";
}