]> gitweb.fluxo.info Git - puppet-mail.git/commitdiff
Switching postfix module to parametrized classes
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 25 Jan 2013 16:03:55 +0000 (14:03 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 25 Jan 2013 16:03:55 +0000 (14:03 -0200)
manifests/base.pp
manifests/system.pp

index c6dd4af6cd42c4673c5e23cee77ccefd8ac60040..77a818ebeedf551242f936aca2b9cf6c61626c69 100644 (file)
@@ -3,9 +3,9 @@ class mail::base {
   postfix::config {
     "mydomain":                            value => "$::domain";
     "myhostname":                          value => "$::fqdn";
-    "mydestination":                       value => "${mail::system::postfix_mydestination}";
-    "mynetworks":                          value => "${mail::system::postfix_mynetworks}";
-    "relay_domains":                       value => "${mail::system::postfix_relay_domains}";
+    "mydestination":                       value => "${mail::system::mydestination}";
+    "mynetworks":                          value => "${mail::system::mynetworks}";
+    "relay_domains":                       value => "${mail::system::real_relay_domains}";
     "transport_maps":                      value => "hash:/etc/postfix/transport, regexp:/etc/postfix/transport_regexp";
     "mailbox_command":                     value => '/usr/bin/maildrop -d ${USER}';
     "virtual_mailbox_base":                value => '/var/mail/virtual';
index 53476950ffa1bd85b6813cfc5a8b01f558ad0c12..c6b06da807b3cc3cb78a00afc58e767a5ddc5e75 100644 (file)
@@ -1,27 +1,30 @@
-class mail::system {
-  $postfix_smtp_listen             = "all"
-  $postfix_use_amavisd             = "yes"
-  $postfix_use_dovecot_lda         = "yes"
-  $postfix_use_schleuder           = "yes"
-  $postfix_use_sympa               = "yes"
-  $postfix_use_mlmmj               = "yes"
-  $postfix_use_firma               = "yes"
-  $postfix_use_submission          = "yes"
-  $postfix_use_smtps               = "no"
-  $postfix_anon_sasl               = "yes"
-  $postfix_manage_transport_regexp = "yes"
-  $postfix_manage_virtual_regexp   = "yes"
-  $postfix_mydestination           = '$myhostname, localhost.$mydomain, localhost'
-  $postfix_default_relay_domains   = '$mydestination'
-  $postfix_mynetworks              = hiera('mail::postfix_mynetworks',        $mail::system::params::postfix_mynetworks)
-  $postfix_manage_tls_policy       = hiera('mail::postfix_manage_tls_policy', $mail::system::params::postfix_manage_tls_policy)
+class mail::system(
+  $mydestination       = hiera('mail::mydestination',       '$myhostname, localhost.$mydomain, localhost'),
+  $relay_domains       = hiera('mail::relay_domains',       ''),
+  $mynetworks          = hiera('mail::postfix_mynetworks',  $mail::system::params::postfix_mynetworks),
+  $root_mail_recipient = hiera('mail::root_mail_recipient', 'nobody')
+) {
 
-  case $sympa_subdomain {
-    '': { $sympa_subdomain = "lists" }
+  # Base postfix class
+  class { 'postfix':
+    root_mail_recipient     => $root_mail_recipient,
+    smtp_listen             => "all"
+    use_amavisd             => "yes"
+    use_dovecot_lda         => "yes"
+    use_schleuder           => "yes"
+    use_sympa               => "yes"
+    use_mlmmj               => "yes"
+    use_firma               => "yes"
+    use_submission          => "yes"
+    use_smtps               => "no"
+    anon_sasl               => "yes"
+    manage_transport_regexp => "yes"
+    manage_virtual_regexp   => "yes"
+    manage_header_checks    => "yes",
+    manage_tls_policy       => hiera('mail::postfix_manage_tls_policy', $mail::system::params::postfix_manage_tls_policy)
   }
 
-  # Module requirements
-  include postfix
+  # SSL support
   include ssl
 
   # Common subsystems
@@ -87,10 +90,8 @@ class mail::system {
     }
   }
 
-  $relay_domains = hiera('mail::relay_domains', '')
-
   case $relay_domains {
-    '': { $postfix_relay_domains = "${postfix_default_relay_domains}${sympa_relay_domains}${schleuder_relay_domains}${mlmmj_relay_domains}${firma_relay_domains}" }
+    '': { $real_relay_domains = "${mydestination}${sympa_relay_domains}${schleuder_relay_domains}${mlmmj_relay_domains}${firma_relay_domains}" }
   }
 
   # Include base configuration