]> git.donarmstrong.com Git - dsa-puppet.git/commitdiff
Reshuffle how virtualdomains file is handled
authorStephen Gran <steve@lobefin.net>
Mon, 22 Apr 2013 20:03:52 +0000 (21:03 +0100)
committerStephen Gran <steve@lobefin.net>
Mon, 22 Apr 2013 20:04:48 +0000 (21:04 +0100)
Signed-off-by: Stephen Gran <steve@lobefin.net>
modules/exim/manifests/init.pp
modules/exim/manifests/vdomain.pp [new file with mode: 0644]
modules/exim/manifests/vdomain/setup.pp [new file with mode: 0644]
modules/exim/templates/virtualdomains.erb

index a9529ca1a78cb7abc564055026c84eb74c7bf407..096100da55dc6ecb59703215510ca850b66d6490 100644 (file)
@@ -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 (file)
index 0000000..3a50cb3
--- /dev/null
@@ -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 (file)
index 0000000..d698ad6
--- /dev/null
@@ -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,
+       }
+}
index 627db680a2b5a1588f4720fcfd1036f13c784d67..7296d175e45896ce89f85f7869d6e842fa263c17 100644 (file)
@@ -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"