summaryrefslogtreecommitdiff
path: root/manifests/web.pp
blob: d0ddf2937c0a3fa47772f777f47e47cb35a71d92 (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
74
75
76
77
78
79
80
81
82
class mail::web::virtual inherits websites::setup {
  include php::imap

  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/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,
    source => "puppet:///modules/mail/roundcube/main.inc.php",
    require => Package['roundcube'],
  }
}

class mail::web::sympa inherits websites::setup {
  apache::site { "$sympa_subdomain":
    docroot => "${apache_www_folder}/${sympa_subdomain}",
    source  => true,
    owner   => sympa,
    group   => sympa,
    mpm     => false,
  }

  package { [ 'apache2-suexec', 'libapache2-mod-fcgid' ]:
    ensure => present,
  }

  apache::module { "fcgid":
    ensure  => present,
    require => Package["libapache2-mod-fcgid"],
  }

  apache::module { "suexec":
    ensure  => present,
    require => Package["apache2-suexec"],
  }

  file { "${apache_www_folder}/${sympa_subdomain}/wwsympa.fcgi":
    ensure  => present,
    owner   => sympa,
    group   => sympa,
    mode    => 0550,
    content => "#!/bin/sh\n/usr/lib/cgi-bin/sympa/wwsympa.fcgi\n",
    require => File["${apache_www_folder}/${sympa_subdomain}"],
  }
}

class mail::web::sympa::disabled inherits mail::web::sympa {
  Apache::Site["$sympa_subdomain"] {
    ensure => absent,
  }

  File["${apache_www_folder}/${sympa_subdomain}/wwsympa.fcgi"] {
    require => undef,
  }
}