summaryrefslogtreecommitdiff
path: root/manifests/virtual.pp
blob: b212d58d0656eb791ff1559b53289373fcd8e780 (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
class mail::virtual(
  $database_user     = hiera('mail::virtual::database_user',     $mail::virtual::params::database_user),
  $database_host     = hiera('mail::virtual::database_host',     $mail::virtual::params::database_host),
  $database_name     = hiera('mail::virtual::database_name',     $mail::virtual::params::database_name),
  $database_password = hiera('mail::virtual::database_password', ''),
) {

  # 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,
  }

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