From: Peter Palfrader Date: Sat, 21 Sep 2019 21:56:08 +0000 (+0200) Subject: Try to make the manualroute on the mailrelays using a store/collect pattern X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=860adcc65aa0cf65c9a98a1529a8af15e8ee45b7;p=mirror%2Fdsa-puppet.git Try to make the manualroute on the mailrelays using a store/collect pattern --- diff --git a/modules/exim/manifests/mailrelay.pp b/modules/exim/manifests/mailrelay.pp index f0feedb59..09afd67dd 100644 --- a/modules/exim/manifests/mailrelay.pp +++ b/modules/exim/manifests/mailrelay.pp @@ -10,4 +10,14 @@ class exim::mailrelay { @hourly root if [ ! -d /etc/exim4/email-virtualdomains ]; then cd /etc/exim4 && git clone mail-git:email-virtualdomains ; fi && cd /etc/exim4/email-virtualdomains && git pull --quiet --ff-only | EOF } + + + concat { '/etc/exim4/manualroute-new': + mode => '0444', + ensure_newline => true, + warn => '# This file is maintained with puppet', + require => Package['exim4-daemon-heavy'] + } + + Concat::Fragment <<| tag == 'exim::manualroute::to::mailrelay' |>> } diff --git a/modules/roles/manifests/mta.pp b/modules/roles/manifests/mta.pp index 3ce44436a..4e672d71f 100644 --- a/modules/roles/manifests/mta.pp +++ b/modules/roles/manifests/mta.pp @@ -15,6 +15,20 @@ class roles::mta( include exim::mx } else { include exim + + $mxdata = dig($deprecated::nodeinfo, 'ldap', 'mxRecord') + if $mxdata and $mxdata =~ /INCOMING-MX/ { + $mailport = lookup('exim::mail_port') + + @@concat::fragment { "manualroute-to-${::fqdn}": + tag => 'exim::manualroute::to::mailrelay', + target => '/etc/exim4/manualroute-new', + content => $mailport == undef ? { + true => "${::fqdn}: ${::fqdn}", + default => "${::fqdn}: ${::fqdn}::${mailport}", + } + } + } } } elsif $type == 'postfix' { if $mailrelay {