summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2016-06-22 17:29:59 -0300
committerSilvio Rhatto <rhatto@riseup.net>2016-06-22 17:29:59 -0300
commit9a7b88ca7ae00e916f0d13dc318c0cab9bbd155d (patch)
tree1706b6f40db17955901e15ed8904b488af8dd113
parentac00c28ffd8ee294d72a044339ad53b2e3e2773f (diff)
downloadpuppet-mail-9a7b88ca7ae00e916f0d13dc318c0cab9bbd155d.tar.gz
puppet-mail-9a7b88ca7ae00e916f0d13dc318c0cab9bbd155d.tar.bz2
Split admin and web clients
-rw-r--r--manifests/virtual/web.pp89
-rw-r--r--manifests/virtual/web/admin.pp25
-rw-r--r--manifests/virtual/web/client.pp60
3 files changed, 88 insertions, 86 deletions
diff --git a/manifests/virtual/web.pp b/manifests/virtual/web.pp
index 17282f7..6d0b0d0 100644
--- a/manifests/virtual/web.pp
+++ b/manifests/virtual/web.pp
@@ -1,88 +1,5 @@
-class mail::virtual::web(
- $postfixadmin_setup_hash = hiera('mail::virtual::web::postfixadmin_setup_hash', $mail::virtual::web::params::postfixadmin_setup_hash),
- $roundcube_des_key = hiera('mail::virtual::web::roundcube_des_key', $mail::virtual::web::params::roundcube_des_key),
- $roundcube_logo = hiera('mail::virtual::web::roundcube_logo', $mail::virtual::web::params::roundcube_logo),
- $roundcube_login_info = hiera('mail::virtual::web::roundcube_login_info', $mail::virtual::web::params::roundcube_login_info)
-) {
-
- # Class configuration
- if $::lsbdistcodename != 'lenny' {
- case $roundcube_des_key {
- '': { fail("You need to define mail::virtual::web::roundcube_des_key config") }
- }
- }
-
- case $postfixadmin_setup_hash {
- '': {
- warning("You need to define mail::virtual::web::postfixadmin_setup_hash config")
- $setup_hash = 'changeme'
- }
- }
-
- include php::imap
+class mail::virtual::web {
include websites::setup
-
- 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,
- }
-
- $web_db_pass = hiera('mail::virtual::web::database::password', '')
-
- database::instance { "mail":
- password => "${web_db_pass}",
- }
-
- file { "${apache::sites_folder}/postfixadmin/site/config.inc.php":
- ensure => present,
- owner => www-data,
- group => root,
- mode => 0640,
- content => template('mail/virtual/postfixadmin/config.inc.php.erb'),
- require => File["${apache::sites_folder}/postfixadmin/site"],
- }
-
- # 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'],
- }
+ include mail::virtual::web::client
+ include mail::virtual::web::admin
}
diff --git a/manifests/virtual/web/admin.pp b/manifests/virtual/web/admin.pp
new file mode 100644
index 0000000..2ec4243
--- /dev/null
+++ b/manifests/virtual/web/admin.pp
@@ -0,0 +1,25 @@
+class mail::virtual::web::admin(
+ $postfixadmin_setup_hash = hiera('mail::virtual::web::postfixadmin_setup_hash', $mail::virtual::web::params::postfixadmin_setup_hash),
+) {
+ case $postfixadmin_setup_hash {
+ '': {
+ warning("You need to define mail::virtual::web::postfixadmin_setup_hash config")
+ $setup_hash = 'changeme'
+ }
+ }
+
+ apache::site { "postfixadmin":
+ docroot => "${apache::sites_folder}/postfixadmin/site",
+ use => [ "Site postfixadmin" ],
+ mpm => false,
+ }
+
+ file { "${apache::sites_folder}/postfixadmin/site/config.inc.php":
+ ensure => present,
+ owner => www-data,
+ group => root,
+ mode => 0640,
+ content => template('mail/virtual/postfixadmin/config.inc.php.erb'),
+ require => File["${apache::sites_folder}/postfixadmin/site"],
+ }
+}
diff --git a/manifests/virtual/web/client.pp b/manifests/virtual/web/client.pp
new file mode 100644
index 0000000..88c9a28
--- /dev/null
+++ b/manifests/virtual/web/client.pp
@@ -0,0 +1,60 @@
+class mail::virtual::web::client(
+ $roundcube_des_key = hiera('mail::virtual::web::roundcube_des_key', $mail::virtual::web::params::roundcube_des_key),
+ $roundcube_logo = hiera('mail::virtual::web::roundcube_logo', $mail::virtual::web::params::roundcube_logo),
+ $roundcube_login_info = hiera('mail::virtual::web::roundcube_login_info', $mail::virtual::web::params::roundcube_login_info)
+) {
+ 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 = hiera('mail::virtual::web::database::password', '')
+
+ 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'],
+ }
+}