# Every one of our hosts has an MTA # # @param type exim4 or postfix. exim4 is our default MTA # @param heavy receive email from the internet and thus do spam filtering etc # @param mailrelay receive mail on other hosts' behalf. implies heavy class roles::mta( Enum['exim4', 'postfix'] $type = 'exim4', Boolean $heavy = false, Boolean $mailrelay = false, ) { if $type == 'exim4' { if $mailrelay { include roles::mailrelay } elsif $heavy { 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 { fail("Unsupported: mailrelay on type ${type}") } include postfix } else { fail("Unexpected mta type ${type}") } }