diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/postfixadmin.pp | 11 | ||||
-rw-r--r-- | manifests/sympa.pp | 19 | ||||
-rw-r--r-- | manifests/system.pp | 16 | ||||
-rw-r--r-- | manifests/virtual.pp | 19 | ||||
-rw-r--r-- | manifests/web.pp | 28 |
5 files changed, 48 insertions, 45 deletions
diff --git a/manifests/postfixadmin.pp b/manifests/postfixadmin.pp index 3ab50e4..a6c87c2 100644 --- a/manifests/postfixadmin.pp +++ b/manifests/postfixadmin.pp @@ -1,9 +1,4 @@ -class mail::postfixadmin( - $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', ''), -) { +class mail::postfixadmin { # Class configuration case $database_password { '': { fail("You need to define database_password host config") } @@ -12,8 +7,8 @@ class mail::postfixadmin( # # Database configuration # - database::instance { "${database_name}": - password => "${database_password}", + database::instance { "${mail::virtual::database_name}": + password => "${mail::virtual::database_password}", } # diff --git a/manifests/sympa.pp b/manifests/sympa.pp index 0ba7841..34ea084 100644 --- a/manifests/sympa.pp +++ b/manifests/sympa.pp @@ -1,13 +1,14 @@ -class mail::sympa { - # Class configuration - $database_password = hiera('sympa_database_password', '') - $database_name = hiera('sympa_database_name', 'sympa') - $database_host = hiera('sympa_database_host', 'localhost') - $listmasters = hiera('sympa_listmasters', "listmaster@${fqdn}") - $lang = hiera('sympa_lang', 'en_US') - $subdomain = hiera('sympa_subdomain', 'lists') - $logo_html_definition = hiera('sympa_logo_html_definition', '') +class mail::sympa( + $database_password = hiera('mail::sympa::database_password', ''), + $database_name = hiera('mail::sympa::database_name', 'sympa'), + $database_host = hiera('mail::sympa::database_host', 'localhost'), + $listmasters = hiera('mail::sympa::listmasters', "listmaster@${fqdn}"), + $lang = hiera('mail::sympa::lang', 'en_US'), + $subdomain = hiera('mail::sympa::subdomain', 'lists'), + $logo_html_definition = hiera('mail::sympa::logo_html_definition', '') +) { + # Class configuration case $database_password { '': { fail("You need to define database_password host config") } } diff --git a/manifests/system.pp b/manifests/system.pp index b810325..bf57896 100644 --- a/manifests/system.pp +++ b/manifests/system.pp @@ -33,9 +33,9 @@ class mail::system { include mail::spamassassin # Virtual mail system - case hiera('mail_virtual', false) { + case hiera('mail::virtual', false) { true: { - include mail::virtual + class { 'mail::virtual': } } default: { include mail::regular @@ -43,9 +43,9 @@ class mail::system { } # Sympa mailing list manager - case hiera('mail_sympa', false) { + case hiera('mail::sympa', false) { true: { - include mail::sympa + class { 'mail::sympa': } $sympa_relay_domains = ", ${mail::sympa::subdomain}.${domain}" } 'disabled': { @@ -56,7 +56,7 @@ class mail::system { } # Schleuder mailing list manager - case hiera('mail_schleuder', false) { + case hiera('mail::schleuder', false) { true: { class { 'mail::schleuder': } $schleuder_relay_domains = ", ${mail::schleuder::subdomain}.${domain}" @@ -64,7 +64,7 @@ class mail::system { } # Mlmmj - case hiera('mail_mlmmj', false) { + case hiera('mail::mlmmj', false) { true: { class { 'mail::mlmmj': } $mlmmj_relay_domains = ", ${mail::mlmmj::subdomain}.${domain}" @@ -72,14 +72,14 @@ class mail::system { } # Firma - case hiera('mail_firma', false) { + case hiera('mail::firma', false) { true: { class { 'mail::firma': } $firma_relay_domains = ", ${mail::firma::subdomain}.${domain}" } } - $relay_domains = hiera('postfix_relay_domains', '') + $relay_domains = hiera('mail::relay_domains', '') case $relay_domains { '': { $postfix_relay_domains = "${postfix_default_relay_domains}${sympa_relay_domains}${schleuder_relay_domains}${mlmmj_relay_domains}${firma_relay_domains}" } diff --git a/manifests/virtual.pp b/manifests/virtual.pp index 577fce0..cf10171 100644 --- a/manifests/virtual.pp +++ b/manifests/virtual.pp @@ -1,4 +1,21 @@ -class mail::virtual { +class mail::virtual::params { + $database_user = 'postfix' + $database_host = 'localhost' + $database_name = 'postfix' +} + +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 database_password host config") } + } + # Virtual subsystems include database include mail::packages::virtual diff --git a/manifests/web.pp b/manifests/web.pp index 16f4b25..065b44e 100644 --- a/manifests/web.pp +++ b/manifests/web.pp @@ -1,12 +1,8 @@ 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) + $postfixadmin_setup_hash = hiera('mail::web::virtual::postfixadmin_setup_hash', ''), + $roundcube_des_key = hiera('mail::web::virtual::roundcube_des_key', ''), + $roundcube_logo = hiera('mail::web::virtual::roundcube_logo', 'null'), + $roundcube_login_info = hiera('mail::web::virtual::roundcube_login_info', false) ) { # Class configuration @@ -16,10 +12,6 @@ class mail::web::virtual( } } - case $database_password { - '': { fail("You need to define database_password host config") } - } - case $postfixadmin_setup_hash { '': { warning("You need to define postfixadmin_setup_hash host config") @@ -81,10 +73,8 @@ class mail::web::virtual( } class mail::web::sympa inherits websites::setup { - $sympa_subdomain = hiera('sympa_subdomain', 'lists') - - apache::site { "$sympa_subdomain": - docroot => "${apache::www_folder}/${sympa_subdomain}", + apache::site { "${sympa::subdomain}": + docroot => "${apache::www_folder}/${sympa::subdomain}", source => true, owner => sympa, group => sympa, @@ -105,13 +95,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}"], } } @@ -128,7 +118,7 @@ class mail::web::sympa::disabled inherits mail::web::sympa { class mail::web::mlmmj inherits websites::setup { $mlmmj_subdomain = hiera('mlmmj_subdomain') - apache::site { "$mlmmj_subdomain": + apache::site { "${mail::mlmmj::subdomain}": docroot => "/usr/share/mlmmj-php-web-admin", owner => 'mlmmj', group => 'mlmmj', |