switch postfix smarthost config to classparams
authorPeter Palfrader <peter@palfrader.org>
Sat, 21 Sep 2019 17:18:32 +0000 (19:18 +0200)
committerPeter Palfrader <peter@palfrader.org>
Sat, 21 Sep 2019 17:18:32 +0000 (19:18 +0200)
data/common.yaml
modules/postfix/manifests/init.pp
modules/postfix/templates/main.cf-header.erb

index e724e5f..493121e 100644 (file)
@@ -13,6 +13,7 @@ resolv::searchpaths: ['debian.org']
 staticsync::user: 'staticsync'
 staticsync::basedir: '/srv/static.debian.org'
 exim::smarthost: 'mailout.debian.org'
+postfix::smarthost: 'mailout.debian.org'
 
 roles::dns_primary::allow_access:
   # easydns
index 88591a9..000522d 100644 (file)
@@ -1,10 +1,23 @@
+# postfix class
+# @param use_smarthost use the smarthost
+# @param smarthost host to relay through (if set and use_smarthost)
 class postfix(
+  Optional[String] $smarthost,
+  Boolean $use_smarthost = true,
   Boolean $manage_maincf = true,
 ) {
   package { 'postfix':
     ensure => installed
   }
 
+  if $use_smarthost {
+    if ! smarthost {
+      fail('No smarthost set but use_smarthost is true')
+    }
+  } else {
+    $heavy = true
+  }
+
   service { 'postfix':
     ensure => running
   }
index 6f6cbe5..0934738 100644 (file)
@@ -4,12 +4,12 @@ mydomain = debian.org
 compatibility_level = 2
 smtp_dns_support_level = dnssec
 
-<%- if scope.lookupvar('deprecated::nodeinfo')['smarthost'].empty? -%>
-smtp_tls_security_level = dane
-<%- else -%>
+<%- if @use_smarthost -%>
 smtp_tls_security_level = dane-only
 # yes, do MX lookups on the relayhost, since those have TLSA records
-relayhost = <%= scope.lookupvar('deprecated::nodeinfo')['smarthost'] %>:submission
+relayhost = <%= @smarthost %>:submission
+<%- else -%>
+smtp_tls_security_level = dane
 <%- end -%>
 
 # tls stuff