summaryrefslogtreecommitdiff
path: root/manifests/virtual.pp
blob: c8957774ebe4502fbed57fc3d5a3029c6c4cff0b (plain)
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
47
48
49
50
51
52
53
54
55
56
class mail::virtual {
  # Class configuration
  case $postfixadmin_database_password {
    '': { fail("You need to define \$postfixadmin_database_password host config") }
  }

  case $postfixadmin_setup_hash {
    '': {
      warning("You need to define \$postfixadmin_setup_hash host config")
      $postfixadmin_setup_hash = 'changeme'
    }
  }

  case $postfixadmin_database_user {
    '': { $postfixadmin_database_user = "postfix" }
  }

  case $postfixadmin_database_host {
    '': { $postfixadmin_database_host = "localhost" }
  }

  case $postfixadmin_database_name {
    '': { $postfixadmin_database_name= "postfix" }
  }

  # Virtual subsystems
  include database
  include mail::packages::virtual
  include mail::sasl
  include mail::dovecot
  include mail::postfixadmin
  include mail::web::virtual

  # Virtual mailboxes
  file { '/var/mail/virtual':
    ensure  => directory,
    owner   => vmail,
    group   => vmail,
    mode    => 0750,
    require => User['vmail'],
  }

  group { "vmail":
    ensure => present,
    gid    => 5000,
  }

  user { "vmail":
    ensure   => present,
    uid      => 5000,
    gid      => "vmail",
    password => "*",
    home     => '/var/mail/virtual',
    require  => Group['vmail'],
  }
}