From 1462ba78c67b838a1f01c04e315f27ddaba710c3 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 25 Jan 2013 14:03:55 -0200 Subject: Switching postfix module to parametrized classes --- manifests/base.pp | 6 +++--- manifests/system.pp | 49 +++++++++++++++++++++++++------------------------ 2 files changed, 28 insertions(+), 27 deletions(-) (limited to 'manifests') diff --git a/manifests/base.pp b/manifests/base.pp index c6dd4af..77a818e 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -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'; diff --git a/manifests/system.pp b/manifests/system.pp index 5347695..c6b06da 100644 --- a/manifests/system.pp +++ b/manifests/system.pp @@ -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 -- cgit v1.2.3