From 34017d07929662aa40a511cf9993cbf33a70ace7 Mon Sep 17 00:00:00 2001 From: Stephen Gran Date: Mon, 22 Apr 2013 21:03:52 +0100 Subject: [PATCH] Reshuffle how virtualdomains file is handled Signed-off-by: Stephen Gran --- modules/exim/manifests/init.pp | 11 ++++++--- modules/exim/manifests/vdomain.pp | 28 +++++++++++++++++++++++ modules/exim/manifests/vdomain/setup.pp | 14 ++++++++++++ modules/exim/templates/virtualdomains.erb | 20 +--------------- 4 files changed, 51 insertions(+), 22 deletions(-) create mode 100644 modules/exim/manifests/vdomain.pp create mode 100644 modules/exim/manifests/vdomain/setup.pp diff --git a/modules/exim/manifests/init.pp b/modules/exim/manifests/init.pp index a9529ca1..096100da 100644 --- a/modules/exim/manifests/init.pp +++ b/modules/exim/manifests/init.pp @@ -1,5 +1,7 @@ class exim { + include exim::vdomain::setup + munin::check { 'ps_exim4': script => 'ps_' } munin::check { 'exim_mailqueue': } munin::check { 'exim_mailstats': } @@ -12,6 +14,12 @@ class exim { Package['exim4-daemon-heavy']->Mailalias<| |> + concat::fragment { 'virtual_domain_template': + target => '/etc/exim4/virtualdomains', + content => template('exim/virtualdomains.erb'), + order => 05, + } + service { 'exim4': ensure => running, require => [ @@ -60,9 +68,6 @@ class exim { file { '/etc/exim4/locals': content => template('exim/locals.erb') } - file { '/etc/exim4/virtualdomains': - content => template('exim/virtualdomains.erb'), - } file { '/etc/exim4/submission-domains': content => template('exim/submission-domains.erb'), } diff --git a/modules/exim/manifests/vdomain.pp b/modules/exim/manifests/vdomain.pp new file mode 100644 index 00000000..3a50cb33 --- /dev/null +++ b/modules/exim/manifests/vdomain.pp @@ -0,0 +1,28 @@ +class exim::vdomain ( + $alias_file, + $user, + $group, + $maildir, + $domain=$name, +) { + include exim::vdomain::setup + + file { $maildir: + ensure => directory, + mode => '0755', + owner => root, + group => root + } + + file { "${maildir}/aliases": + source => $alias_file, + mode => '0644', + owner => root, + group => root + } + + concat::fragment { "virtualdomain_${domain}": + target => '/etc/exim4/virtualdomains', + content => "${domain}: user=${user} group=${group} directory=${maildir}\n", + } +} diff --git a/modules/exim/manifests/vdomain/setup.pp b/modules/exim/manifests/vdomain/setup.pp new file mode 100644 index 00000000..d698ad63 --- /dev/null +++ b/modules/exim/manifests/vdomain/setup.pp @@ -0,0 +1,14 @@ +class exim::vdomain::setup { + concat { '/etc/exim4/virtualdomains': + owner => root, + group => root, + mode => '0644', + require => Package['exim4-daemon-heavy'] + } + + concat::fragment { 'virtualdomains_header': + target => '/etc/exim4/virtualdomains', + source => 'puppet:///modules/exim/virtualdomains.header', + order => 00, + } +} diff --git a/modules/exim/templates/virtualdomains.erb b/modules/exim/templates/virtualdomains.erb index 627db680..7296d175 100644 --- a/modules/exim/templates/virtualdomains.erb +++ b/modules/exim/templates/virtualdomains.erb @@ -1,23 +1,5 @@ -## -## 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 -## - -# This file lists the virtual domains that this host should handle. The -# format is -# host: user=user group=group directory=dir -# Host may be a wildcard. -# User/Group are the symbolic names of the uid/gid to operate under when -# performing deliveries for this name. These should not be root! -# Directory is the directory to look in for data files. The directory and -# files may be group writable. The first file to lookup is DIR/aliases -# which is a traditional exim/sendmail alias file. You can specify -# users, patterns, pipes and filenames. If that fails then -# .forward-foo is tried, should that fail then .forward-default is tried. -# Finally the email will bounce. - <%= -vdoms = case scope.lookupvar('::fqdn') +vdoms = case @fqdn when "busoni.debian.org" then "bugs.debian.org: user=debbugs group=debbugs directory=/srv/bugs.debian.org/mail" when "buxtehude.debian.org" then "bugs.debian.org: user=debbugs group=debbugs directory=/srv/bugs.debian.org/mail" -- 2.39.2