From 86515e9a0f27d36e38faee05beb03cbb99677e73 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 21 Jan 2013 18:01:00 -0200 Subject: Refactoring for 2.7 compatibility --- manifests/web.pp | 54 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 18 deletions(-) (limited to 'manifests/web.pp') diff --git a/manifests/web.pp b/manifests/web.pp index 2dab8e3..16f4b25 100644 --- a/manifests/web.pp +++ b/manifests/web.pp @@ -1,29 +1,43 @@ -class mail::web::virtual inherits websites::setup { +class mail::web::virtual( + $database_user = hiera('postfixadmin_database_user', 'postfix'), + $database_host = hiera('postfixadmin_database_host', 'localhost'), + $database_name = hiera('postfixadmin_database_name', 'postfix'), + $database_password = hiera('postfixadmin_database_password', ''), + $postfixadmin_setup_hash = hiera('postfixadmin_setup_hash', ''), + $roundcube_des_key = hiera('roundcube_des_key', ''), + $roundcube_logo = hiera('roundcube_logo', 'null'), + $roundcube_login_info = hiera('roundcube_login_info', false) +) { + # Class configuration - if $lsbdistcodename != 'lenny' { + if $::lsbdistcodename != 'lenny' { case $roundcube_des_key { - '': { fail("You need to define \$roundcube_des_key host config") } + '': { fail("You need to define roundcube_des_key host config") } } + } - case $roundcube_logo { - '': { $roundcube_logo = 'null' } - } + case $database_password { + '': { fail("You need to define database_password host config") } + } - case $roundcube_login_info { - '': { $roundcube_login_info = false } + case $postfixadmin_setup_hash { + '': { + warning("You need to define postfixadmin_setup_hash host config") + $setup_hash = 'changeme' } } include php::imap + include websites::setup apache::site { "postfixadmin": - docroot => "${apache_sites_folder}/postfixadmin/site", + docroot => "${apache::sites_folder}/postfixadmin/site", use => [ "Site postfixadmin" ], mpm => false, } apache::site { "mail": - docroot => $lsbdistcodename ? { + docroot => $::lsbdistcodename ? { 'lenny' => "/usr/share/squirrelmail", default => "/var/lib/roundcube", }, @@ -31,17 +45,17 @@ class mail::web::virtual inherits websites::setup { mpm => false, } - file { "${apache_sites_folder}/postfixadmin/site/config.inc.php": + 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"], + require => File["${apache::sites_folder}/postfixadmin/site"], } file { "/etc/roundcube/main.inc.php": - ensure => $lsbdistcodename ? { + ensure => $::lsbdistcodename ? { 'lenny' => absent, default => present, }, @@ -53,7 +67,7 @@ class mail::web::virtual inherits websites::setup { } file { "/var/lib/roundcube/plugins/login_info": - ensure => $lsbdistcodename ? { + ensure => $::lsbdistcodename ? { 'lenny' => absent, default => directory, }, @@ -67,8 +81,10 @@ class mail::web::virtual inherits websites::setup { } class mail::web::sympa inherits websites::setup { + $sympa_subdomain = hiera('sympa_subdomain', 'lists') + apache::site { "$sympa_subdomain": - docroot => "${apache_www_folder}/${sympa_subdomain}", + docroot => "${apache::www_folder}/${sympa_subdomain}", source => true, owner => sympa, group => sympa, @@ -89,13 +105,13 @@ class mail::web::sympa inherits websites::setup { require => Package["apache2-suexec"], } - file { "${apache_www_folder}/${sympa_subdomain}/wwsympa.fcgi": + 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}"], + require => File["${apache::www_folder}/${sympa_subdomain}"], } } @@ -104,12 +120,14 @@ class mail::web::sympa::disabled inherits mail::web::sympa { ensure => absent, } - File["${apache_www_folder}/${sympa_subdomain}/wwsympa.fcgi"] { + File["${apache::www_folder}/${sympa_subdomain}/wwsympa.fcgi"] { require => undef, } } class mail::web::mlmmj inherits websites::setup { + $mlmmj_subdomain = hiera('mlmmj_subdomain') + apache::site { "$mlmmj_subdomain": docroot => "/usr/share/mlmmj-php-web-admin", owner => 'mlmmj', -- cgit v1.2.3