summaryrefslogtreecommitdiff
path: root/manifests/virtual/web/client.pp
blob: 016ceecc86f19df43149e9238bc7a0c2be50febe (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
class mail::virtual::web::client(
  $roundcube_des_key    = lookup('mail::virtual::web::roundcube_des_key', undef, undef,       $mail::virtual::web::params::roundcube_des_key),
  $roundcube_logo       = lookup('mail::virtual::web::roundcube_logo', undef, undef,          $mail::virtual::web::params::roundcube_logo),
  $roundcube_login_info = lookup('mail::virtual::web::roundcube_login_info', undef, undef,    $mail::virtual::web::params::roundcube_login_info)
) {
  include php
  include php::imap

  case $roundcube_des_key {
    '': { fail("You need to define mail::virtual::web::roundcube_des_key config") }
  }

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

  $web_db_pass = lookup('mail::virtual::web::database::password', undef, undef, '')

  database::instance { "mail":
    password => "${web_db_pass}",
  }

  # Old config
  file { "/etc/roundcube/main.inc.php":
    ensure => absent,
    owner   => root,
    group   => www-data,
    mode    => '0640',
    require => Package['roundcube'],
  }

  file { "/etc/roundcube/config.inc.php":
    ensure => $::lsbdistcodename ? {
      'lenny' => absent,
      default => present,
    },
    owner   => root,
    group   => www-data,
    mode    => '0640',
    content => template('mail/virtual/roundcube/config.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'],
  }
}