1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
class mail::virtual(
$database_user = lookup('mail::virtual::database_user', undef, undef, $mail::virtual::params::database_user),
$database_host = lookup('mail::virtual::database_host', undef, undef, $mail::virtual::params::database_host),
$database_name = lookup('mail::virtual::database_name', undef, undef, $mail::virtual::params::database_name),
$database_password = lookup('mail::virtual::database_password', undef, undef, ''),
) {
# Check parameters
case $database_password {
'': { fail("You need to define mail::virtual::database_password config") }
}
# Virtual subsystems
include mail::virtual::packages
include mail::sasl
include mail::dovecot
class { [ 'mail::virtual::database', 'mail::virtual::web' ]: }
# Virtual mailboxes
file { '/var/mail/virtual':
ensure => directory,
owner => vmail,
group => vmail,
mode => '0750',
require => User['vmail'],
}
group { "vmail":
ensure => present,
gid => 5000,
}
# The vmail user maybe needs to be in the dovecot group to be able to use the stats-writer
# See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=903161
user { "vmail":
ensure => present,
uid => 5000,
gid => "vmail",
password => "*",
home => '/var/mail/virtual',
#groups => [ 'dovecot', ],
#require => Group['vmail', 'dovecot'],
require => Group['vmail'],
}
}
|