From 9a7b88ca7ae00e916f0d13dc318c0cab9bbd155d Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 22 Jun 2016 17:29:59 -0300 Subject: Split admin and web clients --- manifests/virtual/web.pp | 89 ++--------------------------------------- manifests/virtual/web/admin.pp | 25 ++++++++++++ manifests/virtual/web/client.pp | 60 +++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 86 deletions(-) create mode 100644 manifests/virtual/web/admin.pp create mode 100644 manifests/virtual/web/client.pp (limited to 'manifests') 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'], + } +} -- cgit v1.2.3