Commit d43d79b1 authored by Raphaël Pinson's avatar Raphaël Pinson
Browse files

Variable cleanup:

  Remove has_variable? and scope.lookupvar from templates
  Add parameters to postfix::files
  Pass parameters from postfix to postfix::files
parent b7237445
class postfix::files {
class postfix::files (
$use_amavisd,
$use_dovecot_lda,
$use_schleuder,
$use_sympa,
$smtp_listen,
$mail_user,
$master_smtp,
$master_smtps,
$master_submission,
) {
include postfix::params
file { '/etc/mailname':
......
......@@ -26,15 +26,33 @@ class postfix (
$mail_user = 'vmail', # postfix_mail_user
$myorigin = $::fqdn,
$inet_interfaces = 'localhost',
$master_smtp = undef, # postfix_master_smtp
$master_smtps = undef, # postfix_master_smtps
$master_submission = undef, # postfix_master_submission
) inherits postfix::params {
validate_bool($use_amavisd)
validate_bool($use_dovecot_lda)
validate_bool($use_schleuder)
validate_bool($use_sympa)
validate_string($mail_user)
validate_string($myorigin)
validate_string($inet_interfaces)
validate_string($master_smtp)
validate_string($master_smtps)
class { 'postfix::packages': } ->
class { 'postfix::files': } ~>
class { 'postfix::files':
use_amavisd => $use_amavisd,
use_dovecot_lda => $use_dovecot_lda,
use_schleuder => $use_schleuder,
use_sympa => $use_sympa,
smtp_listen => $smtp_listen,
mail_user => $mail_user,
master_smtp => $master_smtp,
master_smtps => $master_smtps,
master_submission => $master_submission,
} ~>
class { 'postfix::service': } ->
Class['postfix']
}
<% if scope.lookupvar('postfix::use_amavisd') %>
<% if @use_amavisd %>
amavis unix - - - - 2 smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
......@@ -17,15 +17,15 @@ amavis unix - - - - 2 smtp
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
-o smtpd_bind_address=127.0.0.1
<% end -%>
<% if scope.lookupvar('postfix::use_dovecot_lda') %>
<% if @use_dovecot_lda %>
dovecot unix - n n - - pipe
flags=DRhu user=<%= scope.lookupvar('postfix::mail_user') %>:<%= scope.lookupvar('postfix::mail_user') %> argv=/usr/lib/dovecot/deliver -d ${recipient}
flags=DRhu user=<%= @mail_user %>:<%= @mail_user %> argv=/usr/lib/dovecot/deliver -d ${recipient}
<% end -%>
<% if scope.lookupvar('postfix::use_schleuder') %>
<% if @use_schleuder %>
schleuder unix - n n - - pipe
flags=DRhu user=schleuder argv=/usr/bin/schleuder ${user}
<% end -%>
<% if scope.lookupvar('postfix::use_sympa') %>
<% if @use_sympa %>
sympa unix - n n - - pipe
flags=R user=sympa argv=/usr/lib/sympa/bin/queue ${recipient}
sympabounce unix - n n - - pipe
......
......@@ -7,18 +7,18 @@
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
<% if has_variable?('postfix_master_smtp') -%>
<%= @postfix_master_smtp %>
<% elsif scope.lookupvar('postfix::smtp_listen') == 'all' -%>
<% if @master_smtp -%>
<%= @master_smtp %>
<% elsif @smtp_listen == 'all' -%>
smtp inet n - - - - smtpd
<% else -%>
<%= scope.lookupvar('postfix::smtp_listen') %>:smtp inet n - - - - smtpd
<%= @smtp_listen %>:smtp inet n - - - - smtpd
<% end -%>
<% if has_variable?('postfix_master_submission') -%>
<%= postfix_master_submission %>
<% if @master_submission -%>
<%= @master_submission %>
<% end -%>
<% if has_variable?('postfix_master_smtps') -%>
<%= postfix_master_smtps %>
<% if @master_smtps -%>
<%= @master_smtps %>
<% end -%>
#submission inet n - - - - smtpd
# -o smtpd_enforce_tls=yes
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment