Have the nm role declare its exim virtualdomain
[mirror/dsa-puppet.git] / modules / roles / manifests / mta.pp
index 486f3e9..2a783b4 100644 (file)
@@ -15,20 +15,6 @@ class roles::mta(
       include exim::mx
     } else {
       include exim
-
-      $mxdata = dig($deprecated::nodeinfo, 'ldap', 'mXRecord')
-      if $mxdata and $mxdata.any |$item| { $item =~ /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 {
@@ -38,4 +24,26 @@ class roles::mta(
   } else {
     fail("Unexpected mta type ${type}")
   }
+
+
+  $mxdata = dig($deprecated::nodeinfo, 'ldap', 'mXRecord')
+  if $mxdata and $mxdata.any |$item| { $item =~ /INCOMING-MX/ } {
+    $mailport = lookup( { 'name' => 'exim::mail_port', 'default_value' => undef } )
+
+    @@concat::fragment { "manualroute-to-${::fqdn}":
+      tag     => 'exim::manualroute::to::mailrelay',
+      target  => '/etc/exim4/manualroute',
+      content => $mailport == undef ? {
+        true    => "${::fqdn}:   ${::fqdn}",
+        default => "${::fqdn}:   ${::fqdn}::${mailport}",
+      }
+    }
+
+    Ferm::Rule::Simple <<| tag == 'smtp::server::from::mailrelay' |>> {
+      port => $mailport == undef ? {
+        true    => 25,
+        default => $mailport,
+      }
+    }
+  }
 }