exim: build submission domain list dynamically
authorAdam D. Barratt <adam@adam-barratt.org.uk>
Tue, 1 Oct 2019 12:55:34 +0000 (13:55 +0100)
committerAdam D. Barratt <adam@adam-barratt.org.uk>
Wed, 2 Oct 2019 07:08:39 +0000 (08:08 +0100)
and have the bugs_master role declare that it handles bugs.d.o

Signed-off-by: Adam D. Barratt <adam@adam-barratt.org.uk>
modules/exim/manifests/init.pp
modules/exim/manifests/submission-domain.pp [new file with mode: 0644]
modules/exim/templates/submission-domains.erb [deleted file]
modules/roles/manifests/bugs_master.pp

index 0064c8e..9746763 100644 (file)
@@ -90,9 +90,16 @@ class exim (
   file { '/etc/exim4/locals':
     content => template('exim/locals.erb')
   }
-  file { '/etc/exim4/submission-domains':
-    content => template('exim/submission-domains.erb'),
+
+  concat { '/etc/exim4/submission-domains':
+    ensure_newline => true,
+    warn           => @(EOF),
+    ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
+    | EOF
+    target         => '/etc/exim4/submission-domains',
+    order          => '00',
   }
+
   file { '/etc/exim4/host_blacklist':
     source => 'puppet:///modules/exim/common/host_blacklist',
   }
diff --git a/modules/exim/manifests/submission-domain.pp b/modules/exim/manifests/submission-domain.pp
new file mode 100644 (file)
index 0000000..ea7b37f
--- /dev/null
@@ -0,0 +1,11 @@
+# add an exim submission domain entry on this host
+#
+# @param domain     email domain (defaults to $name)
+define exim::submissiondomain (
+  String $domain = $name,
+) {
+  concat::fragment { "submission_${domain}":
+    target  => '/etc/exim4/submission-domains',
+    content => $domain,
+  }
+}
diff --git a/modules/exim/templates/submission-domains.erb b/modules/exim/templates/submission-domains.erb
deleted file mode 100644 (file)
index f45b07d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-##
-### THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
-### USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
-###
-
-<% if %w{buxtehude}.include?( scope.lookupvar('::hostname') ) %>
-bugs.debian.org
-<% end %>
index 3df3c7c..c366d0c 100644 (file)
@@ -11,6 +11,7 @@ class roles::bugs_master {
   }
 
   # The bugs service accepts bug reports on the submission port
+  exim::submissiondomain { 'bugs.debian.org': }
   ferm::rule::simple { 'bugs-submission':
     description => 'Allow submission access from the world',
     port        => 'submission',