diff options
Diffstat (limited to 'manifests')
42 files changed, 210 insertions, 215 deletions
diff --git a/manifests/centos/itk.pp b/manifests/centos/itk.pp index 9e97fa0..20f4270 100644 --- a/manifests/centos/itk.pp +++ b/manifests/centos/itk.pp @@ -5,6 +5,6 @@ class apache::centos::itk inherits apache::centos { name => 'httpd-itk', } File['apache_service_config']{ - source => "puppet:///modules/apache/service/CentOS/httpd.itk" + source => "puppet:///modules/apache/service/${::operatingsystem}/httpd.itk" } } diff --git a/manifests/centos/itk_plus.pp b/manifests/centos/itk_plus.pp index bab2409..0df92c8 100644 --- a/manifests/centos/itk_plus.pp +++ b/manifests/centos/itk_plus.pp @@ -1,7 +1,7 @@ # http://hostby.net/home/2008/07/12/centos-5-and-mpm-itk/ class apache::centos::itk_plus inherits apache::centos::itk { Exec['adjust_pidfile']{ - command => "sed -i 's/^PidFile \(.*\)/#PidFile \1/g' /etc/httpd/conf/httpd.conf", + command => "sed -i 's/^PidFile \\(.*\\)/#PidFile \\1/g' /etc/httpd/conf/httpd.conf", unless => "grep -qE '^#PidFile ' /etc/httpd/conf/httpd.conf", } Exec['adjust_listen']{ @@ -11,7 +11,7 @@ class apache::centos::itk_plus inherits apache::centos::itk { Apache::Config::Global['00-listen.conf']{ ensure => 'present', - content => template("apache/itk_plus/${operatingsystem}/00-listen.conf.erb"), + content => template("apache/itk_plus/${::operatingsystem}/00-listen.conf.erb"), } File['apache_service_config']{ diff --git a/manifests/centos/module.pp b/manifests/centos/module.pp index 4e48b13..3220d1f 100644 --- a/manifests/centos/module.pp +++ b/manifests/centos/module.pp @@ -3,17 +3,17 @@ define apache::centos::module( $source = '', $destination = '' ){ - $modules_dir = "$apache::centos::config_dir/modules.d" + $modules_dir = "${apache::centos::config_dir}/modules.d" $real_destination = $destination ? { '' => "${modules_dir}/${name}.so", default => $destination, } $real_source = $source ? { '' => [ - "puppet:///modules/site_apache/modules.d/${fqdn}/${name}.so", - "puppet:///modules/site_apache/modules.d/${apache_cluster_node}/${name}.so", + "puppet:///modules/site_apache/modules.d/${::fqdn}/${name}.so", + "puppet:///modules/site_apache/modules.d/${apache::cluster_node}/${name}.so", "puppet:///modules/site_apache/modules.d/${name}.so", - "puppet:///modules/apache/modules.d/${operatingsystem}/${name}.so", + "puppet:///modules/apache/modules.d/${::operatingsystem}/${name}.so", "puppet:///modules/apache/modules.d/${name}.so" ], default => "puppet:///$source", diff --git a/manifests/centos/worker.pp b/manifests/centos/worker.pp index 4816fbf..f374bb7 100644 --- a/manifests/centos/worker.pp +++ b/manifests/centos/worker.pp @@ -1,5 +1,5 @@ class apache::centos::worker inherits apache::centos { File['apache_service_config']{ - source => "puppet:///modules/apache/service/CentOS/httpd.worker" + source => "puppet:///modules/apache/service/${::operatingsystem}/httpd.worker" } } diff --git a/manifests/config/file.pp b/manifests/config/file.pp index f25041c..a5b0f2e 100644 --- a/manifests/config/file.pp +++ b/manifests/config/file.pp @@ -34,13 +34,13 @@ define apache::config::file( 'absent': { $real_source = $source ? { 'absent' => [ - "puppet:///modules/site_apache/${confdir}/${fqdn}/${name}", - "puppet:///modules/site_apache/${confdir}/${apache_cluster_node}/${name}", - "puppet:///modules/site_apache/${confdir}/${operatingsystem}.${lsbdistcodename}/${name}", - "puppet:///modules/site_apache/${confdir}/${operatingsystem}/${name}", + "puppet:///modules/site_apache/${confdir}/${::fqdn}/${name}", + "puppet:///modules/site_apache/${confdir}/${apache::cluster_node}/${name}", + "puppet:///modules/site_apache/${confdir}/${::operatingsystem}.${::lsbdistcodename}/${name}", + "puppet:///modules/site_apache/${confdir}/${::operatingsystem}/${name}", "puppet:///modules/site_apache/${confdir}/${name}", - "puppet:///modules/apache/${confdir}/${operatingsystem}.${lsbdistcodename}/${name}", - "puppet:///modules/apache/${confdir}/${operatingsystem}/${name}", + "puppet:///modules/apache/${confdir}/${::operatingsystem}.${::lsbdistcodename}/${name}", + "puppet:///modules/apache/${confdir}/${::operatingsystem}/${name}", "puppet:///modules/apache/${confdir}/${name}" ], default => "puppet:///${source}", @@ -56,8 +56,8 @@ define apache::config::file( } } } - case $operatingsystem { - openbsd: { info("no package dependency on ${operatingsystem} for ${name}") } + case $::operatingsystem { + openbsd: { info("no package dependency on ${::operatingsystem} for ${name}") } default: { File["apache_${name}"]{ require => Package[apache], diff --git a/manifests/debian.pp b/manifests/debian.pp index 2054d2f..345feae 100644 --- a/manifests/debian.pp +++ b/manifests/debian.pp @@ -12,17 +12,16 @@ class apache::debian inherits apache::package { path => "${config_dir}/mods-enabled", } File[htpasswd_dir] { - path => "/var/www/htpasswds", - group => 'www-data', + path => "/var/www/htpasswds", + group => 'www-data', } File[default_apache_index] { path => '/var/www/index.html', } file { 'apache_main_config': path => "${config_dir}/apache2.conf", - source => [ "puppet:///modules/site_apache/config/Debian.${lsbdistcodename}/${fqdn}/apache2.conf", - "puppet:///modules/site_apache/config/Debian/{$fqdn}/apache2.conf", - "puppet:///modules/site_apache/config/Debian.${lsbdistcodename}/apache2.conf", + source => [ "puppet:///modules/site_apache/config/Debian/{$::fqdn}/apache2.conf", + "puppet:///modules/site_apache/config/Debian.${::lsbdistcodename}/apache2.conf", "puppet:///modules/site_apache/config/Debian/apache2.conf", "puppet:///modules/apache/config/Debian/apache2.conf" ], require => Package['apache'], diff --git a/manifests/debian/itk.pp b/manifests/debian/itk.pp index 2dde883..718a81b 100644 --- a/manifests/debian/itk.pp +++ b/manifests/debian/itk.pp @@ -1,9 +1,9 @@ class apache::debian::itk inherits apache::debian { - File['htpasswd_dir']{ - group => 0, - mode => 0644, - } - Package['apache']{ - name => 'apache2-mpm-itk', - } + File['htpasswd_dir']{ + group => 0, + mode => 0644, + } + Package['apache']{ + name => 'apache2-mpm-itk', + } } diff --git a/manifests/debian/module.pp b/manifests/debian/module.pp index 19ac7b6..2c0f510 100644 --- a/manifests/debian/module.pp +++ b/manifests/debian/module.pp @@ -2,10 +2,10 @@ define apache::debian::module( $ensure = present, $package_name = 'absent' ){ - $modules_dir = "$apache::debian::config_dir/mods" + $modules_dir = "${apache::debian::config_dir}/mods" if ($package_name != 'absent') { - package { "${package_name}": + package { $package_name: ensure => $ensure, notify => Service['apache'], require => Package['apache'], diff --git a/manifests/gentoo.pp b/manifests/gentoo.pp index b7bcf94..86be087 100644 --- a/manifests/gentoo.pp +++ b/manifests/gentoo.pp @@ -26,7 +26,7 @@ class apache::gentoo inherits apache::package { # set the default for the ServerName file{"${config_dir}/modules.d/00_default_settings_ServerName.conf": - content => "ServerName ${fqdn}\n", + content => "ServerName ${::fqdn}\n", require => Package[apache], owner => root, group => 0, mode => 0644; } diff --git a/manifests/gentoo/module.pp b/manifests/gentoo/module.pp index 99de0ff..1e9d03a 100644 --- a/manifests/gentoo/module.pp +++ b/manifests/gentoo/module.pp @@ -3,17 +3,17 @@ define apache::gentoo::module( $source = '', $destination = '' ){ - $modules_dir = "$apache::gentoo::config_dir/modules.d" + $modules_dir = "${apache::gentoo::config_dir}/modules.d" $real_destination = $destination ? { '' => "${modules_dir}/${name}.conf", default => $destination, } $real_source = $source ? { '' => [ - "puppet:///modules/site_apache/modules.d/${fqdn}/${name}.conf", - "puppet:///modules/site_apache/modules.d/${apache_cluster_node}/${name}.conf", + "puppet:///modules/site_apache/modules.d/${::fqdn}/${name}.conf", + "puppet:///modules/site_apache/modules.d/${apache::cluster_node}/${name}.conf", "puppet:///modules/site_apache/modules.d/${name}.conf", - "puppet:///modules/apache/modules.d/${operatingsystem}/${name}.conf", + "puppet:///modules/apache/modules.d/${::operatingsystem}/${name}.conf", "puppet:///modules/apache/modules.d/${name}.conf" ], default => "puppet:///$source", diff --git a/manifests/htpasswd_user.pp b/manifests/htpasswd_user.pp index 9fcea0a..c4c5453 100644 --- a/manifests/htpasswd_user.pp +++ b/manifests/htpasswd_user.pp @@ -16,10 +16,6 @@ define apache::htpasswd_user( 'absent': { $real_site = $name } default: { $real_site = $site } } - case $path { - 'absent': { $real_path = "/var/www/htpasswds/${real_site}" } - default: { $real_path = $path } - } if $password_iscrypted { $real_password = $password } else { @@ -28,7 +24,10 @@ define apache::htpasswd_user( file_line{"htpasswd_for_${real_site}": ensure => $ensure, - path => $real_path, + path => $path ? { + 'absent' => "/var/www/htpasswds/${real_site}", + default => $path + }, line => "${username}:${real_password}", } } diff --git a/manifests/init.pp b/manifests/init.pp index db1a077..a471591 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -6,9 +6,9 @@ # Marcel Härry haerry+puppet(at)puzzle.ch # Simon Josi josi+puppet(at)puzzle.ch # -# This program is free software; you can redistribute -# it and/or modify it under the terms of the GNU -# General Public License version 3 as published by +# This program is free software; you can redistribute +# it and/or modify it under the terms of the GNU +# General Public License version 3 as published by # the Free Software Foundation. # @@ -18,12 +18,13 @@ # apache is running. # $apache_default_group: Set this to the group with which the # apache is running. -class apache { +class apache( + $cluster_node = hiera('apache_cluster_node','') +) { case $::operatingsystem { centos: { include apache::centos } gentoo: { include apache::gentoo } - debian: { include apache::debian } - ubuntu: { include apache::ubuntu } + debian,ubuntu: { include apache::debian } openbsd: { include apache::openbsd } default: { include apache::base } } diff --git a/manifests/itk.pp b/manifests/itk.pp index 640b69c..5292343 100644 --- a/manifests/itk.pp +++ b/manifests/itk.pp @@ -3,7 +3,7 @@ # see: http://mpm-itk.sesse.net/ class apache::itk inherits apache { - case $operatingsystem { + case $::operatingsystem { centos: { include ::apache::centos::itk } debian: { include ::apache::debian::itk } default: { include ::apache::base::itk } diff --git a/manifests/itk_plus.pp b/manifests/itk_plus.pp index 64d7c87..7d9f721 100644 --- a/manifests/itk_plus.pp +++ b/manifests/itk_plus.pp @@ -3,7 +3,7 @@ # see: http://mpm-itk.sesse.net/ class apache::itk_plus inherits apache::itk { - case $operatingsystem { + case $::operatingsystem { centos: { include ::apache::centos::itk_plus } default: { fail("itk plus mode is currently only implemented for CentOS") } } diff --git a/manifests/openbsd.pp b/manifests/openbsd.pp index e570dbf..1ba58f4 100644 --- a/manifests/openbsd.pp +++ b/manifests/openbsd.pp @@ -26,8 +26,8 @@ class apache::openbsd inherits apache::base { } file{'apache_main_config': path => "${config_dir}/conf/httpd.conf", - source => [ "puppet:///modules/site_apache/config/OpenBSD/${fqdn}/httpd.conf", - "puppet:///modules/site_apache/config/OpenBSD/${apache_cluster_node}/httpd.conf", + source => [ "puppet:///modules/site_apache/config/OpenBSD/${::fqdn}/httpd.conf", + "puppet:///modules/site_apache/config/OpenBSD/${apache::cluster_node}/httpd.conf", "puppet:///modules/site_apache/config/OpenBSD//httpd.conf", "puppet:///modules/apache/config/OpenBSD/httpd.conf" ], notify => Service['apache'], diff --git a/manifests/sftponly.pp b/manifests/sftponly.pp index 1f9793d..ece726b 100644 --- a/manifests/sftponly.pp +++ b/manifests/sftponly.pp @@ -1,5 +1,5 @@ class apache::sftponly { - case $operatingsystem { + case $::operatingsystem { centos: { include apache::sftponly::centos } } } diff --git a/manifests/ssl.pp b/manifests/ssl.pp index c779da4..a604b05 100644 --- a/manifests/ssl.pp +++ b/manifests/ssl.pp @@ -1,13 +1,13 @@ # manifests/ssl.pp class apache::ssl inherits apache { - case $operatingsystem { + case $::operatingsystem { centos: { include apache::ssl::centos } openbsd: { include apache::ssl::openbsd } debian: { include apache::ssl::debian } defaults: { include apache::ssl::base } } - if $use_shorewall { + if hiera('use_shorewall',false) { include shorewall::rules::https } } diff --git a/manifests/ssl/itk.pp b/manifests/ssl/itk.pp index 62c96cf..5fd3aaf 100644 --- a/manifests/ssl/itk.pp +++ b/manifests/ssl/itk.pp @@ -1,7 +1,7 @@ # manifests/ssl/itk.pp class apache::ssl::itk inherits apache::ssl { - case $operatingsystem { + case $::operatingsystem { centos: { include apache::ssl::itk::centos } } } diff --git a/manifests/ssl/itk_plus.pp b/manifests/ssl/itk_plus.pp index 5c2d202..0c8e667 100644 --- a/manifests/ssl/itk_plus.pp +++ b/manifests/ssl/itk_plus.pp @@ -1,5 +1,5 @@ class apache::ssl::itk_plus inherits apache::ssl::itk { - case $operatingsystem { + case $::operatingsystem { centos: { include ::apache::ssl::itk_plus::centos } default: { fail("itk plus mode is currently only implemented for CentOS") } } diff --git a/manifests/ssl/itk_plus/centos.pp b/manifests/ssl/itk_plus/centos.pp index d76c927..00fb472 100644 --- a/manifests/ssl/itk_plus/centos.pp +++ b/manifests/ssl/itk_plus/centos.pp @@ -1,11 +1,11 @@ class apache::ssl::itk_plus::centos inherits apache::ssl::centos { include apache::ssl::itk::centos Apache::Config::Global['ssl.conf']{ - source => "modules/apache/itk_plus/conf.d/${operatingsystem}/ssl.conf", + source => "modules/apache/itk_plus/conf.d/${::operatingsystem}/ssl.conf", } Apache::Config::Global['00-listen-ssl.conf']{ ensure => 'present', - content => template("apache/itk_plus/${operatingsystem}/00-listen-ssl.conf.erb"), + content => template("apache/itk_plus/${::operatingsystem}/00-listen-ssl.conf.erb"), } } diff --git a/manifests/status.pp b/manifests/status.pp index f67507c..3639b6c 100644 --- a/manifests/status.pp +++ b/manifests/status.pp @@ -1,11 +1,11 @@ # manifests/status.pp class apache::status { - case $operatingsystem { + case $::operatingsystem { centos: { include apache::status::centos } defaults: { include apache::status::base } } - if $use_munin { + if hiera('use_munin',false) { include munin::plugins::apache } } diff --git a/manifests/ubuntu.pp b/manifests/ubuntu.pp deleted file mode 100644 index 0837296..0000000 --- a/manifests/ubuntu.pp +++ /dev/null @@ -1,3 +0,0 @@ -### ubuntu: similar to debian therefor inheritng from there -class apache::ubuntu inherits apache::debian {} - diff --git a/manifests/vhost/davdbdir.pp b/manifests/vhost/davdbdir.pp index a9528f7..459167c 100644 --- a/manifests/vhost/davdbdir.pp +++ b/manifests/vhost/davdbdir.pp @@ -11,7 +11,7 @@ define apache::vhost::davdbdir( case $dav_db_dir { 'absent': { include apache::defaultdavdbdir - $real_dav_db_dir = "/var/www/dav_db_dir/$name" + $real_dav_db_dir = "/var/www/dav_db_dir/${name}" } default: { $real_dav_db_dir = $dav_db_dir } } diff --git a/manifests/vhost/file.pp b/manifests/vhost/file.pp index fdea1f9..b42c4ce 100644 --- a/manifests/vhost/file.pp +++ b/manifests/vhost/file.pp @@ -51,16 +51,16 @@ define apache::vhost::file( $htpasswd_path = 'absent', $use_mod_macro = false ){ - $vhosts_dir = $operatingsystem ? { - centos => "$apache::centos::config_dir/vhosts.d", - gentoo => "$apache::gentoo::config_dir/vhosts.d", - debian => "$apache::debian::config_dir/sites-enabled", - ubuntu => "$apache::ubuntu::config_dir/sites-enabled", - openbsd => "$apache::openbsd::config_dir/vhosts.d", + $vhosts_dir = $::operatingsystem ? { + centos => "${apache::centos::config_dir}/vhosts.d", + gentoo => "${apache::gentoo::config_dir}/vhosts.d", + debian => "${apache::debian::config_dir}/sites-enabled", + ubuntu => "${apache::ubuntu::config_dir}/sites-enabled", + openbsd => "${apache::openbsd::config_dir}/vhosts.d", default => '/etc/apache2/vhosts.d', } $real_vhost_destination = $vhost_destination ? { - 'absent' => "$vhosts_dir/$name.conf", + 'absent' => "${vhosts_dir}/${name}.conf", default => $vhost_destination, } file{"${name}.conf": @@ -98,16 +98,16 @@ define apache::vhost::file( 'absent': { $real_vhost_source = $vhost_source ? { 'absent' => [ - "puppet:///modules/site_apache/vhosts.d/$fqdn/$name.conf", - "puppet:///modules/site_apache/vhosts.d/$apache_cluster_node/$name.conf", - "puppet:///modules/site_apache/vhosts.d/$operatingsystem.$lsbdistcodename/$name.conf", - "puppet:///modules/site_apache/vhosts.d/$operatingsystem/$name.conf", - "puppet:///modules/site_apache/vhosts.d/$name.conf", - "puppet:///modules/apache/vhosts.d/$operatingsystem.$lsbdistcodename/$name.conf", - "puppet:///modules/apache/vhosts.d/$operatingsystem/$name.conf", - "puppet:///modules/apache/vhosts.d/$name.conf" + "puppet:///modules/site_apache/vhosts.d/${::fqdn}/${name}.conf", + "puppet:///modules/site_apache/vhosts.d/{$apache::cluster_node}/${name}.conf", + "puppet:///modules/site_apache/vhosts.d/${::operatingsystem}.${::lsbdistcodename}/${name}.conf", + "puppet:///modules/site_apache/vhosts.d/${::operatingsystem}/${name}.conf", + "puppet:///modules/site_apache/vhosts.d/${name}.conf", + "puppet:///modules/apache/vhosts.d/${::operatingsystem}.${::lsbdistcodename}/${name}.conf", + "puppet:///modules/apache/vhosts.d/${::operatingsystem}/${name}.conf", + "puppet:///modules/apache/vhosts.d/${name}.conf" ], - default => "puppet:///$vhost_source", + default => "puppet:///${vhost_source}", } File["${name}.conf"]{ source => $real_vhost_source, @@ -124,7 +124,7 @@ define apache::vhost::file( 'absent','nodeploy': { info("don't deploy a htpasswd file for ${name}") } default: { if $htpasswd_path == 'absent' { - $real_htpasswd_path = "/var/www/htpasswds/$name" + $real_htpasswd_path = "/var/www/htpasswds/${name}" } else { $real_htpasswd_path = $htpasswd_path } @@ -133,9 +133,9 @@ define apache::vhost::file( } if ($ensure!='absent') { File[$real_htpasswd_path]{ - source => [ "puppet:///modules/site_apache/htpasswds/$fqdn/$name", - "puppet:///modules/site_apache/htpasswds/$apache_cluster_node/$name", - "puppet:///modules/site_apache/htpasswds/$name" ], + source => [ "puppet:///modules/site_apache/htpasswds/${::fqdn}/${name}", + "puppet:///modules/site_apache/htpasswds/${apache::cluster_node}/${name}", + "puppet:///modules/site_apache/htpasswds/${name}" ], owner => root, group => 0, mode => 0644, } } diff --git a/manifests/vhost/file/documentrootfile.pp b/manifests/vhost/file/documentrootfile.pp index 8645323..610d71c 100644 --- a/manifests/vhost/file/documentrootfile.pp +++ b/manifests/vhost/file/documentrootfile.pp @@ -6,19 +6,19 @@ define apache::vhost::file::documentrootfile( $group='0', $mode=440 ){ - file{"$documentroot/$filename": - source => [ "puppet:///modules/site_apache/vhost_varieties/$fqdn/$thedomain/$filename", - "puppet:///modules/site_apache/vhost_varieties/$apache_cluster_node/$thedomain/$filename", - "puppet:///modules/site_apache/vhost_varieties/$operatingsystem.$lsbdistcodename/$thedomain/$filename", - "puppet:///modules/site_apache/vhost_varieties/$operatingsystem/$thedomain/$filename", - "puppet:///modules/site_apache/vhost_varieties/$thedomain/$filename", - "puppet:///modules/apache/vhost_varieties/$thedomain/$filename", - "puppet:///modules/apache/vhost_varieties/$operatingsystem.$lsbdistcodename/$thedomain/$filename", - "puppet:///modules/apache/vhost_varieties/$operatingsystem/$thedomain/$filename", - "puppet:///modules/apache/vhost_varieties/$thedomain/$filename" + file{"${documentroot}/${filename}": + source => [ "puppet:///modules/site_apache/vhost_varieties/${::fqdn}/${thedomain}/${filename}", + "puppet:///modules/site_apache/vhost_varieties/${apache::cluster_node}/${thedomain}/${filename}", + "puppet:///modules/site_apache/vhost_varieties/${::operatingsystem}.${::lsbdistcodename}/${thedomain}/${filename}", + "puppet:///modules/site_apache/vhost_varieties/${::operatingsystem}/${thedomain}/${filename}", + "puppet:///modules/site_apache/vhost_varieties/${thedomain}/${filename}", + "puppet:///modules/apache/vhost_varieties/${thedomain}/${filename}", + "puppet:///modules/apache/vhost_varieties/${::operatingsystem}.${::lsbdistcodename}/${thedomain}/${filename}", + "puppet:///modules/apache/vhost_varieties/${::operatingsystem}/${thedomain}/${filename}", + "puppet:///modules/apache/vhost_varieties/${thedomain}/${filename}" ], ensure => file, - require => Apache::Vhost::Webdir["$thedomain"], + require => Apache::Vhost::Webdir[$thedomain], owner => $owner, group => $group, mode => $mode; } } diff --git a/manifests/vhost/gitweb.pp b/manifests/vhost/gitweb.pp index 5523af1..dab4983 100644 --- a/manifests/vhost/gitweb.pp +++ b/manifests/vhost/gitweb.pp @@ -30,7 +30,7 @@ define apache::vhost::gitweb( ensure => $ensure, path => '/var/www/git', path_is_webdir => true, - logpath => $operatingsystem ? { + logpath => $::operatingsystem ? { centos => '/var/log/httpd', fedora => '/var/log/httpd', redhat => '/var/log/httpd', diff --git a/manifests/vhost/modperl.pp b/manifests/vhost/modperl.pp index c7b9e59..35842dc 100644 --- a/manifests/vhost/modperl.pp +++ b/manifests/vhost/modperl.pp @@ -62,11 +62,11 @@ define apache::vhost::modperl( case $cgi_binpath { 'absent': { $real_path = $path ? { - 'absent' => $operatingsystem ? { + 'absent' => $::operatingsystem ? { openbsd => "/var/www/htdocs/${name}", default => "/var/www/vhosts/${name}" }, - default => "${path}" + default => $path } $real_cgi_binpath = "${real_path}/cgi-bin" } diff --git a/manifests/vhost/passenger.pp b/manifests/vhost/passenger.pp index 5dc58a8..0507add 100644 --- a/manifests/vhost/passenger.pp +++ b/manifests/vhost/passenger.pp @@ -70,11 +70,11 @@ define apache::vhost::passenger( } } $real_path = $path ? { - 'absent' => $operatingsystem ? { + 'absent' => $::operatingsystem ? { openbsd => "/var/www/htdocs/${name}", default => "/var/www/vhosts/${name}" }, - default => "${path}" + default => $path } $gempath = "${real_path}/gems" file{ @@ -83,13 +83,13 @@ define apache::vhost::passenger( owner => $documentroot_owner, group => $run_gid, mode => 0660; ["${real_path}/www/public", "${real_path}/gems"]: ensure => directory, - owner => $documentroot_owner, group => $run_gid, mode => 0640; + owner => $documentroot_owner, group => $run_gid, mode => 0640; } if $passenger_app == 'rails' { file{ "${real_path}/www/config": ensure => directory, - owner => $documentroot_owner, group => $run_gid, mode => 0640; + owner => $documentroot_owner, group => $run_gid, mode => 0640; "${real_path}/www/config/environment.rb": ensure => present, owner => $run_uid, group => $run_gid, mode => 0640; diff --git a/manifests/vhost/php/drupal.pp b/manifests/vhost/php/drupal.pp index d07beb7..4025ada 100644 --- a/manifests/vhost/php/drupal.pp +++ b/manifests/vhost/php/drupal.pp @@ -70,7 +70,7 @@ define apache::vhost::php::drupal( $manage_cron = true ){ $documentroot = $path ? { - 'absent' => $operatingsystem ? { + 'absent' => $::operatingsystem ? { openbsd => "/var/www/htdocs/${name}/www", default => "/var/www/vhosts/${name}/www" }, @@ -89,7 +89,7 @@ define apache::vhost::php::drupal( owner => root, group => 0, mode => 0644; } } - + $std_drupal_php_settings = { magic_quotes_gpc => 0, register_globals => 0, @@ -98,7 +98,7 @@ define apache::vhost::php::drupal( 'mbstring.http_output' => 'pass', 'mbstring.encoding_translation' => 0, } - + # create vhost configuration file ::apache::vhost::php::webapp{$name: ensure => $ensure, diff --git a/manifests/vhost/php/gallery2.pp b/manifests/vhost/php/gallery2.pp index 1eae2b3..d1876ff 100644 --- a/manifests/vhost/php/gallery2.pp +++ b/manifests/vhost/php/gallery2.pp @@ -69,38 +69,36 @@ define apache::vhost::php::gallery2( $upload_dir = 'present' ){ $documentroot = $path ? { - 'absent' => $operatingsystem ? { + 'absent' => $::operatingsystem ? { openbsd => "/var/www/htdocs/${name}/www", default => "/var/www/vhosts/${name}/www" }, default => "${path}/www" } $gdatadir = $path ? { - 'absent' => $operatingsystem ? { + 'absent' => $::operatingsystem ? { openbsd => "/var/www/htdocs/${name}/g2data", default => "/var/www/vhosts/${name}/g2data" }, default => "${path}/g2data" } - file{$gdatadir: - ensure => $ensure ? { - 'present' => directory, - default => absent - }, - owner => $documentroot_owner, group => $documentroot_group, mode => 0660; - } - if ($upload_dir == 'present') or ($upload_dir == 'absent') { - $real_upload_dir = $operatingsystem ? { + $real_upload_dir = $::operatingsystem ? { openbsd => "/var/www/htdocs/${name}/upload", default => "/var/www/vhosts/${name}/upload" } } else { $real_upload_dir = $upload_dir } - - file{$real_upload_dir: - owner => $documentroot_owner, group => $documentroot_group, mode => 0660; + file{ + $gdatadir: + ensure => $ensure ? { + 'present' => directory, + default => absent + }, + owner => $documentroot_owner, group => $documentroot_group, mode => 0660; + $real_upload_dir: + owner => $documentroot_owner, group => $documentroot_group, mode => 0660; } if ($ensure == 'absent') or ($upload_dir == 'absent') { File[$real_upload_dir]{ @@ -119,7 +117,7 @@ define apache::vhost::php::gallery2( safe_mode => 'Off', output_buffering => 'Off', } - + # php upload_tmp_dir case $php_settings[upload_tmp_dir] { '',undef: { @@ -137,8 +135,8 @@ define apache::vhost::php::gallery2( $gallery_php_settings[open_basedir] = "${documentroot}:${php_settings[upload_tmp_dir]}:${php_settings['session.save_path']}:${gdatadir}:${real_upload_dir}" } else { $gallery_php_settings[open_basedir] = "${documentroot}:${php_settings[upload_tmp_dir]}:${php_settings['session.save_path']}:${gdatadir}" - } - + } + $real_php_settings = merge($gallery_php_settings,$php_settings) # create vhost configuration file diff --git a/manifests/vhost/php/joomla.pp b/manifests/vhost/php/joomla.pp index 69b08f6..eed142c 100644 --- a/manifests/vhost/php/joomla.pp +++ b/manifests/vhost/php/joomla.pp @@ -64,13 +64,13 @@ define apache::vhost::php::joomla( include ::apache::include::joomla $documentroot = $path ? { - 'absent' => $operatingsystem ? { + 'absent' => $::operatingsystem ? { openbsd => "/var/www/htdocs/${name}/www", default => "/var/www/vhosts/${name}/www" }, default => "${path}/www" } - + if $mod_security_additional_options == 'absent' { $real_mod_security_additional_options = '# http://optics.csufresno.edu/~kriehn/fedora/fedora_files/f9/howto/modsecurity.html # Exceptions for Joomla Root Directory @@ -79,8 +79,7 @@ define apache::vhost::php::joomla( </LocationMatch> # Exceptions for Joomla Administration Panel - SecRule REQUEST_FILENAME "/administrator/index2.php" \ - "allow,phase:1,nolog,ctl:ruleEngine=Off" + SecRule REQUEST_FILENAME "/administrator/index2.php" "allow,phase:1,nolog,ctl:ruleEngine=Off" # Exceptions for Joomla Component Expose <LocationMatch "^/components/com_expose/expose/manager/amfphp/gateway.php"> @@ -124,22 +123,22 @@ define apache::vhost::php::joomla( htpasswd_file => $htpasswd_file, htpasswd_path => $htpasswd_path, manage_directories => $manage_directories, - managed_directories => [ "$documentroot/administrator/backups", - "$documentroot/administrator/components", - "$documentroot/administrator/language", - "$documentroot/administrator/modules", - "$documentroot/administrator/templates", - "$documentroot/components", - "$documentroot/dmdocuments", - "$documentroot/images", - "$documentroot/language", - "$documentroot/media", - "$documentroot/modules", - "$documentroot/plugins", - "$documentroot/templates", - "$documentroot/cache", - "$documentroot/tmp", - "$documentroot/administrator/cache" ], + managed_directories => [ "${documentroot}/administrator/backups", + "${documentroot}/administrator/components", + "${documentroot}/administrator/language", + "${documentroot}/administrator/modules", + "${documentroot}/administrator/templates", + "${documentroot}/components", + "${documentroot}/dmdocuments", + "${documentroot}/images", + "${documentroot}/language", + "${documentroot}/media", + "${documentroot}/modules", + "${documentroot}/plugins", + "${documentroot}/templates", + "${documentroot}/cache", + "${documentroot}/tmp", + "${documentroot}/administrator/cache" ], manage_config => $manage_config, config_webwriteable => $config_webwriteable, config_file => 'configuration.php', diff --git a/manifests/vhost/php/silverstripe.pp b/manifests/vhost/php/silverstripe.pp index d120f04..da58296 100644 --- a/manifests/vhost/php/silverstripe.pp +++ b/manifests/vhost/php/silverstripe.pp @@ -61,11 +61,11 @@ define apache::vhost::php::silverstripe( $config_webwriteable = false, $manage_directories = true ){ - + include ::apache::include::silverstripe - + $documentroot = $path ? { - 'absent' => $operatingsystem ? { + 'absent' => $::operatingsystem ? { openbsd => "/var/www/htdocs/${name}/www", default => "/var/www/vhosts/${name}/www" }, @@ -109,7 +109,7 @@ define apache::vhost::php::silverstripe( htpasswd_file => $htpasswd_file, htpasswd_path => $htpasswd_path, manage_directories => $manage_directories, - managed_directories => [ "$documentroot/assets" ], + managed_directories => [ "${documentroot}/assets" ], manage_config => $manage_config, } diff --git a/manifests/vhost/php/simplemachine.pp b/manifests/vhost/php/simplemachine.pp index 78a165e..b5178da 100644 --- a/manifests/vhost/php/simplemachine.pp +++ b/manifests/vhost/php/simplemachine.pp @@ -62,7 +62,7 @@ define apache::vhost::php::simplemachine( $manage_directories = true ){ $documentroot = $path ? { - 'absent' => $operatingsystem ? { + 'absent' => $::operatingsystem ? { openbsd => "/var/www/htdocs/${name}/www", default => "/var/www/vhosts/${name}/www" }, @@ -105,15 +105,15 @@ define apache::vhost::php::simplemachine( htpasswd_path => $htpasswd_path, manage_directories => $manage_directories, managed_directories => [ - "$documentroot/agreement.txt", - "$documentroot/attachments", - "$documentroot/avatars", - "$documentroot/cache", - "$documentroot/Packages", - "$documentroot/Packages/installed.list", - "$documentroot/Smileys", - "$documentroot/Themes", - "$documentroot/Themes/default/languages/Install.english.php" + "${documentroot}/agreement.txt", + "${documentroot}/attachments", + "${documentroot}/avatars", + "${documentroot}/cache", + "${documentroot}/Packages", + "${documentroot}/Packages/installed.list", + "${documentroot}/Smileys", + "${documentroot}/Themes", + "${documentroot}/Themes/default/languages/Install.english.php" ], manage_config => $manage_config, config_webwriteable => $config_webwriteable, diff --git a/manifests/vhost/php/spip.pp b/manifests/vhost/php/spip.pp index 696ac8b..5f4ffdb 100644 --- a/manifests/vhost/php/spip.pp +++ b/manifests/vhost/php/spip.pp @@ -59,7 +59,7 @@ define apache::vhost::php::spip( $htpasswd_path = 'absent' ){ $documentroot = $path ? { - 'absent' => $operatingsystem ? { + 'absent' => $::operatingsystem ? { openbsd => "/var/www/htdocs/${name}/www", default => "/var/www/vhosts/${name}/www" }, @@ -100,7 +100,12 @@ define apache::vhost::php::spip( vhost_destination => $vhost_destination, htpasswd_file => $htpasswd_file, htpasswd_path => $htpasswd_path, - managed_directories => [ "$documentroot/IMG", "$documentroot/tmp", "$documentroot/local", "$documentroot/config" ], + managed_directories => [ + "${documentroot}/IMG", + "${documentroot}/tmp", + "${documentroot}/local", + "${documentroot}/config" + ], manage_config => false, } } diff --git a/manifests/vhost/php/standard.pp b/manifests/vhost/php/standard.pp index aea4551..3814680 100644 --- a/manifests/vhost/php/standard.pp +++ b/manifests/vhost/php/standard.pp @@ -78,9 +78,9 @@ define apache::vhost::php::standard( documentroot_mode => $documentroot_mode, } } - + $real_path = $path ? { - 'absent' => $operatingsystem ? { + 'absent' => $::operatingsystem ? { openbsd => "/var/www/htdocs/${name}", default => "/var/www/vhosts/${name}" }, @@ -96,13 +96,13 @@ define apache::vhost::php::standard( 'absent' => "$real_path/logs", default => $logpath } - + $std_php_options = { smarty => false, pear => false, } $real_php_options = merge($std_php_options,$php_options) - + if $real_php_options[smarty] { include php::extensions::smarty $smarty_path = '/usr/share/php/Smarty/:' @@ -115,7 +115,7 @@ define apache::vhost::php::standard( } else { $pear_path = '' } - + $std_php_settings = { engine => 'On', @@ -130,7 +130,7 @@ define apache::vhost::php::standard( if $run_mode == 'fcgid' { $std_php_settings[safe_mode_gid] = 'On' } - + if has_key($php_settings,'safe_mode_exec_dir') { $php_safe_mode_exec_dir = $php_settings[safe_mode_exec_dir] } else { @@ -166,7 +166,7 @@ define apache::vhost::php::standard( ensure => absent, } } - + if !has_key($php_settings,'default_charset') { if $default_charset != 'absent' { $std_php_settings[default_charset] = $default_charset ? { @@ -175,15 +175,12 @@ define apache::vhost::php::standard( } } } - + $real_php_settings = merge($std_php_settings,$php_settings) - + $passing_extension = 'php' if $ensure != 'absent' { case $run_mode { - 'itk': { - include ::php::itk - } 'proxy-itk','static-itk': { include ::php::itk_plus } diff --git a/manifests/vhost/php/typo3.pp b/manifests/vhost/php/typo3.pp index 6ed0fa5..a9f12d8 100644 --- a/manifests/vhost/php/typo3.pp +++ b/manifests/vhost/php/typo3.pp @@ -62,13 +62,13 @@ define apache::vhost::php::typo3( $manage_directories = true ){ $documentroot = $path ? { - 'absent' => $operatingsystem ? { + 'absent' => $::operatingsystem ? { openbsd => "/var/www/htdocs/${name}/www", default => "/var/www/vhosts/${name}/www" }, default => "${path}/www" } - + $modsec_rules = ["960010"] $real_mod_security_rules_to_disable = array_union($mod_security_rules_to_disable,$modsec_rules) if $mod_security_additional_options == 'absent' { @@ -80,7 +80,7 @@ define apache::vhost::php::typo3( } else { $real_mod_security_additional_options = $mod_security_additional_options } - + $typo3_php_settings = { # turn allow_url_fopen on for the extension manager fetch allow_url_fopen => 'On' @@ -122,23 +122,23 @@ define apache::vhost::php::typo3( htpasswd_file => $htpasswd_file, htpasswd_path => $htpasswd_path, manage_directories => $manage_directories, - managed_directories => [ "$documentroot/typo3temp", - "$documentroot/typo3temp/pics", - "$documentroot/typo3temp/temp", - "$documentroot/typo3temp/llxml", - "$documentroot/typo3temp/cs", - "$documentroot/typo3temp/GB", - "$documentroot/typo3temp/locks", - "$documentroot/typo3conf", - "$documentroot/typo3conf/ext", - "$documentroot/typo3conf/l10n", - # "$documentroot/typo3/ext/", # only needed for ext manager installing global extensions - "$documentroot/uploads", - "$documentroot/uploads/pics", - "$documentroot/uploads/media", - "$documentroot/uploads/tf", - "$documentroot/fileadmin", - "$documentroot/fileadmin/_temp_" + managed_directories => [ "${documentroot}/typo3temp", + "${documentroot}/typo3temp/pics", + "${documentroot}/typo3temp/temp", + "${documentroot}/typo3temp/llxml", + "${documentroot}/typo3temp/cs", + "${documentroot}/typo3temp/GB", + "${documentroot}/typo3temp/locks", + "${documentroot}/typo3conf", + "${documentroot}/typo3conf/ext", + "${documentroot}/typo3conf/l10n", + # "${documentroot}/typo3/ext/", # only needed for ext manager installing global extensions + "${documentroot}/uploads", + "${documentroot}/uploads/pics", + "${documentroot}/uploads/media", + "${documentroot}/uploads/tf", + "${documentroot}/fileadmin", + "${documentroot}/fileadmin/_temp_" ], manage_config => $manage_config, } diff --git a/manifests/vhost/php/wordpress.pp b/manifests/vhost/php/wordpress.pp index fef0807..b3f98c1 100644 --- a/manifests/vhost/php/wordpress.pp +++ b/manifests/vhost/php/wordpress.pp @@ -63,7 +63,7 @@ define apache::vhost::php::wordpress( ){ $documentroot = $path ? { - 'absent' => $operatingsystem ? { + 'absent' => $::operatingsystem ? { openbsd => "/var/www/htdocs/${name}/www", default => "/var/www/vhosts/${name}/www" }, @@ -98,7 +98,7 @@ define apache::vhost::php::wordpress( mod_security => $mod_security, mod_security_relevantonly => $mod_security_relevantonly, mod_security_rules_to_disable => $real_mod_security_rules_to_disable, - mod_security_additional_options => $mod_security_additional_options, + mod_security_additional_options => $mod_security_additional_options, ssl_mode => $ssl_mode, vhost_mode => $vhost_mode, template_partial => $template_partial, @@ -107,7 +107,7 @@ define apache::vhost::php::wordpress( htpasswd_file => $htpasswd_file, htpasswd_path => $htpasswd_path, manage_directories => $manage_directories, - managed_directories => "$documentroot/wp-content", + managed_directories => "${documentroot}/wp-content", manage_config => $manage_config, config_webwriteable => $config_webwriteable, config_file => 'wp-config.php', diff --git a/manifests/vhost/redirect.pp b/manifests/vhost/redirect.pp index ec23fb7..a106c59 100644 --- a/manifests/vhost/redirect.pp +++ b/manifests/vhost/redirect.pp @@ -38,7 +38,7 @@ define apache::vhost::redirect( path_is_webdir => true, domainalias => $domainalias, server_admin => $server_admin, - logpath => $operatingsystem ? { + logpath => $::operatingsystem ? { openbsd => '/var/www/logs', centos => '/var/log/httpd', default => '/var/log/apache2' diff --git a/manifests/vhost/template.pp b/manifests/vhost/template.pp index 11926a6..c19faba 100644 --- a/manifests/vhost/template.pp +++ b/manifests/vhost/template.pp @@ -74,20 +74,20 @@ define apache::vhost::template( $ldap_user = 'any' ){ $real_path = $path ? { - 'absent' => $operatingsystem ? { - openbsd => "/var/www/htdocs/$name", - default => "/var/www/vhosts/$name" + 'absent' => $::operatingsystem ? { + openbsd => "/var/www/htdocs/${name}", + default => "/var/www/vhosts/${name}" }, default => $path } if $path_is_webdir { - $documentroot = "$real_path" + $documentroot = $real_path } else { - $documentroot = "$real_path/www" + $documentroot = "${real_path}/www" } $logdir = $logpath ? { - 'absent' => "$real_path/logs", + 'absent' => "${real_path}/logs", default => $logpath } @@ -101,7 +101,7 @@ define apache::vhost::template( default => $domainalias } if $htpasswd_path == 'absent' { - $real_htpasswd_path = "/var/www/htpasswds/$name" + $real_htpasswd_path = "/var/www/htpasswds/${name}" } else { $real_htpasswd_path = $htpasswd_path } @@ -112,10 +112,10 @@ define apache::vhost::template( case $run_mode { 'fcgid','itk','proxy-itk','static-itk': { case $run_uid { - 'absent': { fail("you have to define run_uid for $name on $fqdn") } + 'absent': { fail("you have to define run_uid for ${name} on ${::fqdn}") } } case $run_gid { - 'absent': { fail("you have to define run_gid for $name on $fqdn") } + 'absent': { fail("you have to define run_gid for ${name} on ${::fqdn}") } } } } @@ -123,7 +123,7 @@ define apache::vhost::template( # dav db dir case $dav_db_dir { 'absent': { - $real_dav_db_dir = "/var/www/dav_db_dir/$name" + $real_dav_db_dir = "/var/www/dav_db_dir/${name}" } default: { $real_dav_db_dir = $dav_db_dir } } diff --git a/manifests/vhost/webdav.pp b/manifests/vhost/webdav.pp index e175324..003a308 100644 --- a/manifests/vhost/webdav.pp +++ b/manifests/vhost/webdav.pp @@ -58,7 +58,7 @@ define apache::vhost::webdav( $ldap_user = 'any', $dav_db_dir = 'absent' ){ - ::apache::vhost::davdbdir{"${name}": + ::apache::vhost::davdbdir{$name: ensure => $ensure, dav_db_dir => $dav_db_dir, documentroot_owner => $documentroot_owner, diff --git a/manifests/vhost/webdir.pp b/manifests/vhost/webdir.pp index ca3b2b6..e9eda1b 100644 --- a/manifests/vhost/webdir.pp +++ b/manifests/vhost/webdir.pp @@ -13,7 +13,7 @@ define apache::vhost::webdir( $documentroot_recurse = false ){ $real_path = $path ? { - 'absent' => $operatingsystem ? { + 'absent' => $::operatingsystem ? { openbsd => "/var/www/htdocs/${name}", default => "/var/www/vhosts/${name}" }, @@ -31,7 +31,7 @@ define apache::vhost::webdir( if $owner == 'apache' { if $apache_default_user == '' { - $real_owner = $operatingsystem ? { + $real_owner = $::operatingsystem ? { openbsd => 'www', debian => 'www-data', default => $owner @@ -44,7 +44,7 @@ define apache::vhost::webdir( } if $group == 'apache' { if $apache_default_group == '' { - $real_group = $operatingsystem ? { + $real_group = $::operatingsystem ? { openbsd => 'www', debian => 'www-data', default => $group @@ -58,7 +58,7 @@ define apache::vhost::webdir( if $documentroot_owner == 'apache' { if $apache_default_user == '' { - $real_documentroot_owner = $operatingsystem ? { + $real_documentroot_owner = $::operatingsystem ? { openbsd => 'www', debian => 'www-data', default => $documentroot_owner @@ -71,7 +71,7 @@ define apache::vhost::webdir( } if $documentroot_group == 'apache' { if $apache_default_group == '' { - $real_documentroot_group = $operatingsystem ? { + $real_documentroot_group = $::operatingsystem ? { openbsd => 'www', debian => 'www-data', default => $documentroot_group @@ -85,9 +85,9 @@ define apache::vhost::webdir( case $ensure { absent: { if $manage_docroot { - $managed_directories = [ "$real_path", "${real_path}/private", "$logdir", "$documentroot" ] + $managed_directories = [ $real_path, "${real_path}/private", $logdir, $documentroot ] } else { - $managed_directories = [ "$real_path", "${real_path}/private", "$logdir" ] + $managed_directories = [ $real_path, "${real_path}/private", $logdir ] } file{$managed_directories: ensure => absent, @@ -97,12 +97,12 @@ define apache::vhost::webdir( } } default: { - file{"$real_path": + file{$real_path: ensure => directory, owner => $real_owner, group => $real_group, mode => $real_mode; } if $manage_docroot { - file{"$documentroot": + file{$documentroot: ensure => directory, recurse => $documentroot_recurse, owner => $real_documentroot_owner, group => $real_documentroot_group, mode => $documentroot_mode; @@ -112,7 +112,7 @@ define apache::vhost::webdir( ensure => directory, owner => $real_documentroot_owner, group => $real_documentroot_group, mode => 0660; } - case $operatingsystem { + case $::operatingsystem { centos: { include apache::logrotate::centos::vhosts } } file{"${real_path}/private": diff --git a/manifests/worker.pp b/manifests/worker.pp index e7a96fa..9a7b3be 100644 --- a/manifests/worker.pp +++ b/manifests/worker.pp @@ -1,5 +1,5 @@ class apache::worker inherits apache { - case $operatingsystem { + case $::operatingsystem { centos: { include ::apache::centos::worker } } } |