From: Peter Palfrader Date: Sun, 22 Sep 2019 10:04:15 +0000 (+0200) Subject: Create an exim::manualroute define X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=0300b7631fa167ceec3c38b779d0ba31b20c2b66;p=mirror%2Fdsa-puppet.git Create an exim::manualroute define --- diff --git a/modules/exim/manifests/manualroute.pp b/modules/exim/manifests/manualroute.pp new file mode 100644 index 000000000..9167adcd4 --- /dev/null +++ b/modules/exim/manifests/manualroute.pp @@ -0,0 +1,22 @@ +# register an exim manualroute on the mail relays +# +# @param domain email domain (defaults to $name) +# @param target targethost +# @param mailport targetport (defaults to exim::mail_port if set, else 25) +define exim::manualroute ( + String $domain = $name, + String $target = $::fqdn, + Optional[Integer] $mailport = undef, +) { + if $mailport { + $port = $mailport + } else { + $port = lookup( { 'name' => 'exim::mail_port', 'default_value' => 25 } ) + } + + @@concat::fragment { "manualroute-to-${::domain}": + tag => 'exim::manualroute::to::mailrelay', + target => '/etc/exim4/manualroute', + content => "${::domain}: ${::target}::${port}", + } +} diff --git a/modules/roles/manifests/mta.pp b/modules/roles/manifests/mta.pp index 511a00b71..9044803dd 100644 --- a/modules/roles/manifests/mta.pp +++ b/modules/roles/manifests/mta.pp @@ -32,11 +32,7 @@ class roles::mta( if $mxdata and $mxdata.any |$item| { $item =~ /INCOMING-MX/ } { # a mail satellite. Gets mail via the mailrelays and sends out mail via the mail relays - @@concat::fragment { "manualroute-to-${::fqdn}": - tag => 'exim::manualroute::to::mailrelay', - target => '/etc/exim4/manualroute', - content => "${::fqdn}: ${::fqdn}::${mailport}", - } + exim::manualroute{ $::fqdn: } @@ferm::rule::simple { "submission-from-${::fqdn}": tag => 'smtp::server::submission::to::mail-relay',