From ff6b42fc09f010d98bbbfc98e3cfe11e3be0fe26 Mon Sep 17 00:00:00 2001 From: Ossi Salmi Date: Tue, 9 Nov 2010 14:41:06 +0200 Subject: [PATCH] Added apache modules --- apache/manifests/init.pp | 236 ++++++++++++++++++++++++++++++-- apache/templates/proxy.conf.erb | 12 ++ puppet/manifests/init.pp | 8 +- 3 files changed, 239 insertions(+), 17 deletions(-) create mode 100644 apache/templates/proxy.conf.erb diff --git a/apache/manifests/init.pp b/apache/manifests/init.pp index 64db96d..dee758d 100644 --- a/apache/manifests/init.pp +++ b/apache/manifests/init.pp @@ -310,17 +310,85 @@ class apache::mod::auth_kerb { } +# Install mod_authnz_ldap. +# +class apache::mod::authnz_ldap { + + case $operatingsystem { + debian,ubuntu: { + apache::debian::a2enmod { "authnz_ldap": } + } + centos,fedora: { } + default: { + fail("Apache module not supported in ${operatingsystem}.") + } + } + +} + + # Install mod_fcgid. # class apache::mod::fcgid { package { "mod_fcgid": - ensure => installed, + name => $operatingsystem ? { + debian => "libapache2-mod-fcgid", + ubuntu => "libapache2-mod-fcgid", + default => "mod_fcgid", + }, + ensure => installed, require => Package["httpd"], } - apache::configfile { "fcgid.conf": - require => Package["mod_fcgid"], + case $operatingsystem { + debian,ubuntu: { + apache::debian::a2enmod { "fcgid": + require => Package ["libapache2-mod-fcgid"], + } + } + centos,fedora: { + apache::configfile { "fcgid.conf": + require => Package["mod_fcgid"], + } + } + default: { + fail("Apache module not supported in ${operatingsystem}.") + } + } + +} + + +# Install mod_headers. +# +class apache::mod::headers { + + case $operatingsystem { + debian,ubuntu: { + apache::debian::a2enmod { "headers": } + } + centos,fedora: { } + default: { + fail("Apache module not supported in ${operatingsystem}.") + } + } + +} + + +# Install mod_ldap. +# +class apache::mod::ldap { + + case $operatingsystem { + debian,ubuntu: { + apache::debian::a2enmod { "ldap": } + } + centos,fedora: { } + default: { + fail("Apache module not supported in ${operatingsystem}.") + } } } @@ -331,12 +399,29 @@ class apache::mod::fcgid { class apache::mod::perl { package { "mod_perl": - ensure => installed, + name => $operatingsystem ? { + debian => "libapache2-mod-perl2", + ubuntu => "libapache2-mod-perl2", + default => "mod_perl", + }, + ensure => installed, require => Package["httpd"], } - apache::configfile { "perl.conf": - require => Package["mod_perl"], + case $operatingsystem { + debian,ubuntu: { + apache::debian::a2enmod { "perl2": + require => Package ["libapache2-mod-perl2"], + } + } + centos,fedora: { + apache::configfile { "perl.conf": + require => Package["mod_perl"], + } + } + default: { + fail("Apache module not supported in ${operatingsystem}.") + } } } @@ -347,12 +432,86 @@ class apache::mod::perl { class apache::mod::php { package { "php": - ensure => installed, + name => $operatingsystem ? { + debian => "libapache2-mod-php5", + ubuntu => "libapache2-mod-php5", + default => "php", + }, + ensure => installed, require => Package["httpd"], } - apache::configfile { "php.conf": - require => Package["php"], + case $operatingsystem { + debian,ubuntu: { + apache::debian::a2enmod { "php5": + require => Package ["libapache2-mod-php5"], + } + } + centos,fedora: { + apache::configfile { "php.conf": + require => Package["php"], + } + } + default: { + fail("Apache module not supported in ${operatingsystem}.") + } + } + +} + + +# Install mod_proxy +# +class apache::mod::proxy { + + case $operatingsystem { + debian,ubuntu: { + apache::debian::a2enmod { "proxy": + content => template("apache/proxy.conf.erb"), + } + } + centos,fedora: { + apache::configfile { "proxy.conf": + content => template("apache/proxy.conf.erb"), + } + } + default: { + fail("Apache module not supported in ${operatingsystem}.") + } + } + +} + + +# Install mod_proxy_http +# +class apache::mod::proxy_http { + + case $operatingsystem { + debian,ubuntu: { + apache::debian::a2enmod { "proxy_http": } + } + centos,fedora: { } + default: { + fail("Apache module not supported in ${operatingsystem}.") + } + } + +} + + +# Install mod_proxy_balancer +# +class apache::mod::proxy_balancer { + + case $operatingsystem { + debian,ubuntu: { + apache::debian::a2enmod { "proxy_balancer": } + } + centos,fedora: { } + default: { + fail("Apache module not supported in ${operatingsystem}.") + } } } @@ -363,12 +522,46 @@ class apache::mod::php { class apache::mod::python { package { "mod_python": + name => $operatingsystem ? { + debian => "libapache2-mod-python", + ubuntu => "libapache2-mod-python", + default => "mod_python", + }, ensure => installed, require => Package["httpd"], } - apache::configfile { "python.conf": - require => Package["mod_python"], + case $operatingsystem { + debian,ubuntu: { + apache::debian::a2enmod { "python": + require => Package ["libapache2-mod-python"], + } + } + centos,fedora: { + apache::configfile { "python.conf": + require => Package["mod_python"], + } + } + default: { + fail("Apache module not supported in ${operatingsystem}.") + } + } + +} + + +# Install mod_rewrite. +# +class apache::mod::rewrite { + + case $operatingsystem { + debian,ubuntu: { + apache::debian::a2enmod { "rewrite": } + } + centos,fedora: { } + default: { + fail("Apache module not supported in ${operatingsystem}.") + } } } @@ -379,12 +572,29 @@ class apache::mod::python { class apache::mod::wsgi { package { "mod_wsgi": + name => $operatingsystem ? { + debian => "libapache2-mod-wsgi", + ubuntu => "libapache2-mod-wsgi", + default => "mod_wsgi", + }, ensure => installed, require => Package["httpd"], } - apache::configfile { "wsgi.conf": - require => Package["mod_wsgi"], + case $operatingsystem { + debian,ubuntu: { + apache::debian::a2enmod { "wsgi": + require => Package ["libapache2-mod-wsgi"], + } + } + centos,fedora: { + apache::configfile { "wsgi.conf": + require => Package["mod_wsgi"], + } + } + default: { + fail("Apache module not supported in ${operatingsystem}.") + } } } diff --git a/apache/templates/proxy.conf.erb b/apache/templates/proxy.conf.erb new file mode 100644 index 0000000..4b5cf76 --- /dev/null +++ b/apache/templates/proxy.conf.erb @@ -0,0 +1,12 @@ +<% if has_variable?("apache_proxy_allow") -%> +ProxyRequests On +ProxyVia On + + + Order deny,allow + Deny from all + Allow from <%= apache_proxy_allow %> + +<% else -%> +ProxyRequests Off +<% end -%> diff --git a/puppet/manifests/init.pp b/puppet/manifests/init.pp index 3ae4ace..bb72892 100644 --- a/puppet/manifests/init.pp +++ b/puppet/manifests/init.pp @@ -187,10 +187,10 @@ class puppet::server inherits puppet::client { } case $operatingsystem { debian,ubuntu: { - apache::debian::a2enmod { "headers": } - apache::debian::a2enmod { "proxy": } - apache::debian::a2enmod { "proxy_http": } - apache::debian::a2enmod { "proxy_balancer": } + include apache::mod::headers + include apache::mod::proxy + include apache::mod::proxy_http + include apache::mod::proxy_balancer } }