summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-01-21 18:01:00 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-01-21 18:01:00 -0200
commit86515e9a0f27d36e38faee05beb03cbb99677e73 (patch)
tree355b620ee9ea98be6d54f87c506b64b2024c8076 /manifests
parent14d954ff02564493192fe1fc9ad3a148ba20ef60 (diff)
downloadpuppet-mail-86515e9a0f27d36e38faee05beb03cbb99677e73.tar.gz
puppet-mail-86515e9a0f27d36e38faee05beb03cbb99677e73.tar.bz2
Refactoring for 2.7 compatibility
Diffstat (limited to 'manifests')
-rw-r--r--manifests/amavisd.pp2
-rw-r--r--manifests/base.pp12
-rw-r--r--manifests/dovecot.pp2
-rw-r--r--manifests/firma.pp7
-rw-r--r--manifests/mlmmj.pp13
-rw-r--r--manifests/packages.pp2
-rw-r--r--manifests/postfixadmin.pp16
-rw-r--r--manifests/schleuder.pp7
-rw-r--r--manifests/sympa.pp42
-rw-r--r--manifests/system.pp44
-rw-r--r--manifests/virtual.pp28
-rw-r--r--manifests/web.pp54
12 files changed, 110 insertions, 119 deletions
diff --git a/manifests/amavisd.pp b/manifests/amavisd.pp
index 7d15804..12accfa 100644
--- a/manifests/amavisd.pp
+++ b/manifests/amavisd.pp
@@ -41,7 +41,7 @@ class mail::amavisd {
notify => Service['amavis'],
}
- case $lsbdistcodename {
+ case $::lsbdistcodename {
'lenny': { }
default: {
file { "/etc/amavis/conf.d/05-node_id":
diff --git a/manifests/base.pp b/manifests/base.pp
index f4bb97f..c6dd4af 100644
--- a/manifests/base.pp
+++ b/manifests/base.pp
@@ -1,11 +1,11 @@
class mail::base {
# Postfix configuration
postfix::config {
- "mydomain": value => "$domain";
- "myhostname": value => "$fqdn";
- "mydestination": value => "$postfix_mydestination";
- "mynetworks": value => "$postfix_mynetworks";
- "relay_domains": value => "$postfix_relay_domains";
+ "mydomain": value => "$::domain";
+ "myhostname": value => "$::fqdn";
+ "mydestination": value => "${mail::system::postfix_mydestination}";
+ "mynetworks": value => "${mail::system::postfix_mynetworks}";
+ "relay_domains": value => "${mail::system::postfix_relay_domains}";
"transport_maps": value => "hash:/etc/postfix/transport, regexp:/etc/postfix/transport_regexp";
"mailbox_command": value => '/usr/bin/maildrop -d ${USER}';
"virtual_mailbox_base": value => '/var/mail/virtual';
@@ -15,7 +15,7 @@ class mail::base {
}
# Postgrey port configuration
- $postgrey_port = $lsbdistcodename ? {
+ $postgrey_port = $::lsbdistcodename ? {
'lenny' => '60000',
default => '10023',
}
diff --git a/manifests/dovecot.pp b/manifests/dovecot.pp
index c054678..c4f7b4b 100644
--- a/manifests/dovecot.pp
+++ b/manifests/dovecot.pp
@@ -10,7 +10,7 @@ class mail::dovecot {
owner => root,
group => vmail,
mode => 0644,
- content => template("mail/dovecot/dovecot.conf.${lsbdistcodename}.erb"),
+ content => template("mail/dovecot/dovecot.conf.${::lsbdistcodename}.erb"),
notify => Service['dovecot'],
}
diff --git a/manifests/firma.pp b/manifests/firma.pp
index c1ab5a9..ec59879 100644
--- a/manifests/firma.pp
+++ b/manifests/firma.pp
@@ -1,4 +1,7 @@
-class mail::firma {
+class mail::firma(
+ $subdomain = hiera('firma_subdomain', 'firma')
+) {
+
# Firma subsystems
include mail::packages::firma
@@ -12,7 +15,7 @@ class mail::firma {
content => template('mail/postfix/firma/virtual_regexp.erb'),
}
- postfix::transport { "${firma_subdomain}.$domain":
+ postfix::transport { "${subdomain}.$domain":
ensure => absent,
destination => "firma",
}
diff --git a/manifests/mlmmj.pp b/manifests/mlmmj.pp
index 9db4356..6c58b79 100644
--- a/manifests/mlmmj.pp
+++ b/manifests/mlmmj.pp
@@ -1,4 +1,7 @@
-class mail::mlmmj {
+class mail::mlmmj(
+ $subdomain = hiera('mlmmj_subdomain', 'mlmmj')
+) {
+
include mail::packages::mlmmj
include mail::web::mlmmj::disabled
@@ -46,13 +49,13 @@ class mail::mlmmj {
#
# That's why we need one definition per mailing list.
define list($ensure = 'present') {
- postfix::transport_regexp_snippet { "mlmmj_transport_regexp-$name":
- content => "/^($name)\\@.*$/ mlmmj:$name\n",
+ postfix::transport_regexp_snippet { "mlmmj_transport_regexp-${name}":
+ content => "/^(${name})\\@.*$/ mlmmj:${name}\n",
ensure => $ensure,
}
- postfix::transport_regexp_snippet { "mlmmj_transport_regexp-$name-request":
- content => "/^($name)\\+.*\\@.*$/ mlmmj:$name\n",
+ postfix::transport_regexp_snippet { "mlmmj_transport_regexp-${name}-request":
+ content => "/^(${name})\\+.*\\@.*$/ mlmmj:${name}\n",
ensure => $ensure,
}
}
diff --git a/manifests/packages.pp b/manifests/packages.pp
index 548b833..2e3649d 100644
--- a/manifests/packages.pp
+++ b/manifests/packages.pp
@@ -27,7 +27,7 @@ class mail::packages::virtual {
}
# Squeeze (or newer) packages
- if $lsbdistcodename != 'lenny' {
+ if $::lsbdistcodename != 'lenny' {
package { [ 'roundcube', 'roundcube-sqlite', 'roundcube-plugins', 'roundcube-plugins-extra' ]:
ensure => latest,
}
diff --git a/manifests/postfixadmin.pp b/manifests/postfixadmin.pp
index 07d555b..3ab50e4 100644
--- a/manifests/postfixadmin.pp
+++ b/manifests/postfixadmin.pp
@@ -1,9 +1,19 @@
-class mail::postfixadmin {
+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 configuration
+ case $database_password {
+ '': { fail("You need to define database_password host config") }
+ }
+
#
# Database configuration
#
- database::instance { "$postfixadmin_database_name":
- password => "$postfixadmin_database_password",
+ database::instance { "${database_name}":
+ password => "${database_password}",
}
#
diff --git a/manifests/schleuder.pp b/manifests/schleuder.pp
index b9c502e..1f42fcd 100644
--- a/manifests/schleuder.pp
+++ b/manifests/schleuder.pp
@@ -1,10 +1,13 @@
-class mail::schleuder {
+class mail::schleuder(
+ $subdomain = hiera('schleuder_subdomain', 'encrypted')
+) {
+
# Schleuder subsystems
include mail::packages::schleuder
postfix::config { "schleuder_destination_recipient_limit": value => '1', nonstandard => true }
- postfix::transport { "${schleuder_subdomain}.$domain":
+ postfix::transport { "${subdomain}.$domain":
ensure => present,
destination => "schleuder",
}
diff --git a/manifests/sympa.pp b/manifests/sympa.pp
index 5b042d5..0ba7841 100644
--- a/manifests/sympa.pp
+++ b/manifests/sympa.pp
@@ -1,35 +1,27 @@
class mail::sympa {
- # Sympa subsystems
- include mail::web::sympa
- include mail::packages::sympa
-
# Class configuration
- case $sympa_database_password {
- '': { fail("You need to define \$sympa_database_password host config") }
- }
-
- case $sympa_database_name {
- '': { $sympa_database_name= "sympa" }
- }
+ $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', '')
- case $sympa_database_host {
- '': { $sympa_database_host = "localhost" }
+ case $database_password {
+ '': { fail("You need to define database_password host config") }
}
- case $sympa_listmasters {
- '': { $sympa_listmasters = "listmaster@${fqdn}" }
- }
-
- case $sympa_lang {
- '': { $sympa_lang = "en_US" }
- }
+ # Sympa subsystems
+ include mail::web::sympa
+ include mail::packages::sympa
#
# Database configuration
#
- database::instance { "$sympa_database_name":
- password => "$sympa_database_password",
- privileges => $lsbdistcodename ? {
+ database::instance { "${database_name}":
+ password => "${database_password}",
+ privileges => $::lsbdistcodename ? {
'lenny' => 'all',
default => [ 'alter_priv', 'alter_routine_priv', 'create_priv',
'create_routine_priv', 'create_tmp_table_priv',
@@ -70,7 +62,7 @@ class mail::sympa {
owner => sympa,
group => sympa,
mode => 0640,
- content => template("mail/sympa/sympa.conf.${lsbdistcodename}.erb"),
+ content => template("mail/sympa/sympa.conf.${::lsbdistcodename}.erb"),
require => [ File['/etc/sympa'], User['sympa'] ],
notify => Service['apache', 'sympa'],
}
@@ -87,7 +79,7 @@ class mail::sympa {
owner => root,
group => root,
mode => 0600,
- content => template("mail/sympa/dbconfig-common.${lsbdistcodename}.erb"),
+ content => template("mail/sympa/dbconfig-common.${::lsbdistcodename}.erb"),
require => File['/etc/dbconfig-common'],
}
diff --git a/manifests/system.pp b/manifests/system.pp
index 42444ca..8106b2b 100644
--- a/manifests/system.pp
+++ b/manifests/system.pp
@@ -13,10 +13,7 @@ class mail::system {
$postfix_manage_virtual_regexp = "yes"
$postfix_mydestination = '$myhostname, localhost.$mydomain, localhost'
$postfix_default_relay_domains = '$mydestination'
-
- case $postfix_mynetworks {
- '': { $postfix_mynetworks = "127.0.0.0/8" }
- }
+ $postfix_mynetworks = hiera('postfix_mynetworks', "127.0.0.0/8")
case $sympa_subdomain {
'': { $sympa_subdomain = "lists" }
@@ -35,7 +32,7 @@ class mail::system {
include mail::spamassassin
# Virtual mail system
- case $mail_virtual {
+ case hiera('mail_virtual', true) {
true: {
include mail::virtual
}
@@ -45,10 +42,10 @@ class mail::system {
}
# Sympa mailing list manager
- case $mail_sympa {
+ case hiera('mail_sympa', false) {
true: {
- $sympa_relay_domains = ", ${sympa_subdomain}.${domain}"
include mail::sympa
+ $sympa_relay_domains = ", ${mail::sympa::subdomain}.${domain}"
}
'disabled': {
include mail::sympa::disabled
@@ -58,41 +55,30 @@ class mail::system {
}
# Schleuder mailing list manager
- case $mail_schleuder {
+ case hiera('mail_schleuder', false) {
true: {
- case $schleuder_subdomain {
- '': { $schleuder_subdomain = "encrypted" }
- }
-
- $schleuder_relay_domains = ", ${schleuder_subdomain}.${domain}"
- include mail::schleuder
+ class { 'mail::schleuder: }
+ $schleuder_relay_domains = ", ${mail::schleuder::subdomain}.${domain}"
}
}
# Mlmmj
- case $mail_mlmmj {
- true: {
- case $mlmmj_subdomain {
- '': { $mlmmj_subdomain = "mlmmj" }
- }
-
- $mlmmj_relay_domains = ", ${mlmmj_subdomain}.${domain}"
- include mail::mlmmj
+ case hiera('mail_mlmmj', false) {
+ class { 'mail::mlmmj': }
+ $mlmmj_relay_domains = ", ${mail::mlmmj::subdomain}.${domain}"
}
}
# Firma
- case $mail_firma {
+ case hiera('mail_firma', false) {
true: {
- case $firma_subdomain {
- '': { $firma_subdomain = "firma" }
- }
-
- $firma_relay_domains = ", ${firma_subdomain}.${domain}"
- include mail::firma
+ class { 'mail::firma': }
+ $firma_relay_domains = ", ${mail::firma::subdomain}.${domain}"
}
}
+ $postfix_relay_domains = hiera('postfix_relay_domains', '')
+
case $postfix_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 c895777..d351209 100644
--- a/manifests/virtual.pp
+++ b/manifests/virtual.pp
@@ -1,35 +1,11 @@
class mail::virtual {
- # Class configuration
- case $postfixadmin_database_password {
- '': { fail("You need to define \$postfixadmin_database_password host config") }
- }
-
- case $postfixadmin_setup_hash {
- '': {
- warning("You need to define \$postfixadmin_setup_hash host config")
- $postfixadmin_setup_hash = 'changeme'
- }
- }
-
- case $postfixadmin_database_user {
- '': { $postfixadmin_database_user = "postfix" }
- }
-
- case $postfixadmin_database_host {
- '': { $postfixadmin_database_host = "localhost" }
- }
-
- case $postfixadmin_database_name {
- '': { $postfixadmin_database_name= "postfix" }
- }
-
# Virtual subsystems
include database
include mail::packages::virtual
include mail::sasl
include mail::dovecot
- include mail::postfixadmin
- include mail::web::virtual
+
+ class { [ 'mail::postfixadmin', 'mail::web::virtual' }
# Virtual mailboxes
file { '/var/mail/virtual':
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',