From 3b9e600c947d00500a4f3e4d566aac3bc907a936 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 15 Sep 2019 21:51:18 +0200 Subject: [PATCH] Partially migrate the mailrelay role. ferm still needs the old style. --- hieradata/common.yaml | 2 +- hieradata/nodes/mailly.debian.org.yaml | 5 +++++ hieradata/nodes/muffat.debian.org.yaml | 5 +++++ modules/exim/manifests/init.pp | 2 +- modules/exim/manifests/mx.pp | 2 +- modules/exim/templates/manualroute.erb | 2 +- modules/exim/templates/virtualdomains.erb | 2 +- modules/roles/manifests/init.pp | 4 ---- modules/roles/manifests/mailrelay.pp | 22 +++++++++++----------- 9 files changed, 26 insertions(+), 20 deletions(-) create mode 100644 hieradata/nodes/mailly.debian.org.yaml create mode 100644 hieradata/nodes/muffat.debian.org.yaml diff --git a/hieradata/common.yaml b/hieradata/common.yaml index 48c21b226..e72b759a6 100644 --- a/hieradata/common.yaml +++ b/hieradata/common.yaml @@ -48,7 +48,7 @@ roles: # XXX - used by ferm templates/defs.conf.erb - fasolo.debian.org mailrelay: - # XXX - used by ferm templates/defs.conf.erb + # XXX - ONLY used by ferm templates/defs.conf.erb - mailly.debian.org - muffat.debian.org mirrormaster: diff --git a/hieradata/nodes/mailly.debian.org.yaml b/hieradata/nodes/mailly.debian.org.yaml new file mode 100644 index 000000000..806a80296 --- /dev/null +++ b/hieradata/nodes/mailly.debian.org.yaml @@ -0,0 +1,5 @@ +--- +classes: + - roles::mailrelay + +exim::is_mailrelay: true diff --git a/hieradata/nodes/muffat.debian.org.yaml b/hieradata/nodes/muffat.debian.org.yaml new file mode 100644 index 000000000..806a80296 --- /dev/null +++ b/hieradata/nodes/muffat.debian.org.yaml @@ -0,0 +1,5 @@ +--- +classes: + - roles::mailrelay + +exim::is_mailrelay: true diff --git a/modules/exim/manifests/init.pp b/modules/exim/manifests/init.pp index 882a3c2f7..3596c318e 100644 --- a/modules/exim/manifests/init.pp +++ b/modules/exim/manifests/init.pp @@ -1,9 +1,9 @@ class exim ( Boolean $is_bugsmx = false, + Boolean $is_mailrelay = false, Boolean $is_rtmaster = false, ) { - $is_mailrelay = has_role('mailrelay') $is_packagesmaster = has_role('packagesmaster') $is_packagesqamaster = has_role('packagesqamaster') diff --git a/modules/exim/manifests/mx.pp b/modules/exim/manifests/mx.pp index 34558a3fb..e60cfb777 100644 --- a/modules/exim/manifests/mx.pp +++ b/modules/exim/manifests/mx.pp @@ -35,7 +35,7 @@ class exim::mx inherits exim { ensure => installed, } - if has_role('mailrelay') { + if $exim::is_mailrelay { concat::fragment { 'puppet-crontab--email-virtualdomains': target => '/etc/cron.d/puppet-crontab', content => @(EOF) diff --git a/modules/exim/templates/manualroute.erb b/modules/exim/templates/manualroute.erb index c7ce96c1e..8a070333b 100644 --- a/modules/exim/templates/manualroute.erb +++ b/modules/exim/templates/manualroute.erb @@ -12,7 +12,7 @@ mxmatches = [ @fqdn ] routes = [] extraroutes = [] -if scope.function_has_role(['mailrelay']) +if @is_mailrelay mxmatches << 'mailout.debian.org' mxmatches << 'INCOMING-MX' extraroutes = [ ] diff --git a/modules/exim/templates/virtualdomains.erb b/modules/exim/templates/virtualdomains.erb index 59f492050..98086ff02 100644 --- a/modules/exim/templates/virtualdomains.erb +++ b/modules/exim/templates/virtualdomains.erb @@ -28,7 +28,7 @@ packages.qa.debian.org: user=qa group=qa directory=/srv/packages.qa.debian.org/m end vdoms %> -<% if classes.include?("roles::mailrelay") -%> +<% if @is_mailrelay -%> debian.org: user=nobody group=Debian directory=/etc/exim4/email-virtualdomains/debian.org admin.debian.org: user=mail_admin group=mail_admin directory=/etc/exim4/email-virtualdomains/admin.debian.org ftp-master.debian.org: user=nobody group=nogroup directory=/etc/exim4/email-virtualdomains/ftp-master.debian.org diff --git a/modules/roles/manifests/init.pp b/modules/roles/manifests/init.pp index cac91ffea..7d4addb25 100644 --- a/modules/roles/manifests/init.pp +++ b/modules/roles/manifests/init.pp @@ -49,10 +49,6 @@ class roles { include roles::syncproxy } - if has_role('mailrelay') { - include roles::mailrelay - } - if has_role('dns_primary') { include roles::dns_primary } diff --git a/modules/roles/manifests/mailrelay.pp b/modules/roles/manifests/mailrelay.pp index 388370a7a..f7c1a047a 100644 --- a/modules/roles/manifests/mailrelay.pp +++ b/modules/roles/manifests/mailrelay.pp @@ -7,17 +7,17 @@ # include roles::mailrelay # class roles::mailrelay { - include roles::pubsub::parameters + include roles::pubsub::parameters - $rabbit_password = $roles::pubsub::parameters::rabbit_password + $rabbit_password = $roles::pubsub::parameters::rabbit_password - roles::pubsub::config { 'emailvdomains': - key => 'dsa-emailvdomains-receive', - exchange => dsa, - queue => "email-${::fqdn}", - topic => 'dsa.email.update', - vhost => dsa, - username => $::fqdn, - password => $rabbit_password - } + roles::pubsub::config { 'emailvdomains': + key => 'dsa-emailvdomains-receive', + exchange => dsa, + queue => "email-${::fqdn}", + topic => 'dsa.email.update', + vhost => dsa, + username => $::fqdn, + password => $rabbit_password + } } -- 2.20.1