summaryrefslogtreecommitdiff
path: root/manifests/virtual/web.pp
blob: 34918399cc84916bc7a92976f11bd6bd7b6361c3 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
class mail::virtual::web(
  $postfixadmin_setup_hash = hiera('mail::virtual::web::postfixadmin_setup_hash', $mail::virtual::web::params::postfixadmin_setup_hash),
  $roundcube_des_key       = hiera('mail::virtual::web::roundcube_des_key',       $mail::virtual::web::params::roundcube_des_key),
  $roundcube_logo          = hiera('mail::virtual::web::roundcube_logo',          $mail::virtual::web::params::roundcube_logo),
  $roundcube_login_info    = hiera('mail::virtual::web::roundcube_login_info',    $mail::virtual::web::params::roundcube_login_info)
) {

  # Class configuration
  if $::lsbdistcodename != 'lenny' {
    case $roundcube_des_key {
      '': { fail("You need to define mail::virtual::web::roundcube_des_key config") }
    }
  }

  case $postfixadmin_setup_hash {
    '': {
      warning("You need to define mail::virtual::web::postfixadmin_setup_hash config")
      $setup_hash = 'changeme'
    }
  }

  include php::imap
  include websites::setup

  apache::site { "postfixadmin":
    docroot => "${apache::sites_folder}/postfixadmin/site",
    use     => [ "Site postfixadmin" ],
    mpm     => false,
  }

  apache::site { "mail":
    docroot => $::lsbdistcodename ? {
      'lenny' => "/usr/share/squirrelmail",
      default => "/var/lib/roundcube",
    },
    source  => true,
    mpm     => false,
  }

  file { "${apache::sites_folder}/postfixadmin/site/config.inc.php":
    ensure  => present,
    owner   => www-data,
    group   => root,
    mode    => 0640,
    content => template('mail/virtual/postfixadmin/config.inc.php.erb'),
    require => File["${apache::sites_folder}/postfixadmin/site"],
  }

  file { "/etc/roundcube/main.inc.php":
    ensure => $::lsbdistcodename ? {
      'lenny' => absent,
      default => present,
    },
    owner   => root,
    group   => www-data,
    mode    => 0640,
    content => template('mail/virtual/roundcube/main.inc.php.erb'),
    require => Package['roundcube'],
  }

  file { "/var/lib/roundcube/plugins/login_info":
    ensure => $::lsbdistcodename ? {
      'lenny' => absent,
      default => directory,
    },
    recurse => true,
    owner   => root,
    group   => root,
    mode    => 0644,
    source  => "puppet:///modules/mail/roundcube/plugins/login_info",
    require => Package['roundcube'],
  }
}