1 # Every one of our hosts has an MTA
3 # @param type exim4 or postfix. exim4 is our default MTA
4 # @param heavy receive email from the internet and thus do spam filtering etc
5 # @param mailrelay receive mail on other hosts' behalf. implies heavy
7 Enum['exim4', 'postfix'] $type = 'exim4',
8 Boolean $heavy = false,
9 Boolean $mailrelay = false,
13 include roles::mailrelay
21 $mxdata = dig($deprecated::nodeinfo, 'ldap', 'mXRecord')
22 if $mxdata and $mxdata.any |$item| { $item =~ /INCOMING-MX/ } {
23 $mailport = lookup( { 'name' => 'exim::mail_port', 'default_value' => undef } )
26 @@concat::fragment { "manualroute-to-${::fqdn}":
27 tag => 'exim::manualroute::to::mailrelay',
28 target => '/etc/exim4/manualroute-new',
29 content => $mailport == undef ? {
30 true => "${::fqdn}: ${::fqdn}",
31 default => "${::fqdn}: ${::fqdn}::${mailport}",
35 Ferm::Rule::Simple <<| tag == 'smtp::server::from::mailrelay' |>> {
40 } elsif $type == 'postfix' {
42 fail("Unsupported: mailrelay on type ${type}")
46 fail("Unexpected mta type ${type}")