From 92ab02215470aaf4100e582b0d628734156d7a65 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 3 Nov 2009 17:50:41 -0200 Subject: Adding website definition --- manifests/init.pp | 65 ++++++++++++++++++++++++++++++++++++-- templates/macros | 87 --------------------------------------------------- templates/macros.erb | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++ templates/website.erb | 1 + 4 files changed, 151 insertions(+), 89 deletions(-) delete mode 100644 templates/macros create mode 100644 templates/macros.erb create mode 100644 templates/website.erb diff --git a/manifests/init.pp b/manifests/init.pp index 782ac6f..5172678 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,4 +1,28 @@ -# apache class +# +# Puppet module for Apache +# +# This module is distributed under the GNU Affero General Public License: +# +# Backup module for puppet +# Copyright (C) 2009 Sarava Group +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +# TODO: log level, log files, etc +# TODO: better variable names, enable value overwriting +$apache_sites_folder = '/var/users/home'; +$apache_www_folder = '/var/www/sarava'; class apache { @@ -9,5 +33,42 @@ class apache { require => Package["apache"], } -} + # apache mod_macro configuration + file { "/etc/apache2/conf.d/macros": + ensure => present, + content => template('apache/macros.erb'), + owner => root, + group => root, + mode => 0644, + require => Service["apache"], + notify => Service["apache"], + } + + # TODO: ensure folders exist with right modes and ownership + define website($ensure = present, $drupal = false, $pmwiki = false, + $moin = false, $trac = false, $ikiwiki = false, + $custom = false) { + file { "/etc/apache2/sites-available/$title": + ensure => $ensure, + content => template('apache/website.erb'), + owner => root, + group => root, + mode => 0644, + require => Service["apache"], + notify => Service["apache"], + } + $status = $ensure ? { + 'present' => "/etc/apache2/sites-available/$title", + default => 'absent', + } + + file { "/etc/apache2/sites-enabled/$title": + ensure => $status, + owner => root, + group => root, + require => File["/etc/apache2/sites-available/$title"], + notify => Service["apache"], + } + } +} diff --git a/templates/macros b/templates/macros deleted file mode 100644 index e40bcd5..0000000 --- a/templates/macros +++ /dev/null @@ -1,87 +0,0 @@ - - # begin svn config - - DAV svn - SVNPath /var/svn/$repos - - AuthType Basic - AuthName "Subversion $repos" - AuthUserFile /var/svn/$repos/conf/htpasswd - - # For any operations other than these, require an authenticated user. - - Require valid-user - - - # end svn config - - - - # begin drupal config - - Options Indexes Includes FollowSymLinks MultiViews - AllowOverride All - - # end drupal config - - - - # begin wiki config - - Options Indexes Includes FollowSymLinks MultiViews - AllowOverride All - - # end wiki config - - - - # begin site config - - Options Indexes Includes FollowSymLinks MultiViews - AllowOverride All - - # end site config - - - - # begin trac config - - SetHandler mod_python - PythonInterpreter main_interpreter - PythonHandler trac.web.modpython_frontend - PythonOption TracEnv /var/users/home/$site/trac - PythonOption TracUriRoot /trac - - # This prevents strange behavior when using trac - # in the same virtual host with software that - # has rewrite rules in .htaccess, such as drupal - RewriteEngine off - - - - AuthType Basic - AuthName "Trac $site" - AuthUserFile /var/users/home/$site/trac/auth/.htpasswd - Require valid-user - - # end trac config - - - - # begin moin config - Alias /moinroot /usr/share/moin/htdocs/ - # TODO: fastcgi - ScriptAlias /moin "/var/users/home/$site/moin/cgi-bin/moin.cgi" - # end moin config - ScriptAlias /moin "/var/users/home/$site/moin/cgi-bin/moin.cgi" - # end moin config - - - - # begin ikiwiki config - - Options Indexes Includes FollowSymLinks MultiViews ExecCGI - AllowOverride All - - # end ikiwiki config - diff --git a/templates/macros.erb b/templates/macros.erb new file mode 100644 index 0000000..1a9d05c --- /dev/null +++ b/templates/macros.erb @@ -0,0 +1,87 @@ + + # begin svn config + + DAV svn + SVNPath /var/svn/$repos + + AuthType Basic + AuthName "Subversion $repos" + AuthUserFile /var/svn/$repos/conf/htpasswd + + # For any operations other than these, require an authenticated user. + + Require valid-user + + + # end svn config + + + + # begin drupal config + /drupal-$version> + Options Indexes Includes FollowSymLinks MultiViews + AllowOverride All + + # end drupal config + + + + # begin wiki config + /$site/wiki> + Options Indexes Includes FollowSymLinks MultiViews + AllowOverride All + + # end wiki config + + + + # begin site config + /$name/site> + Options Indexes Includes FollowSymLinks MultiViews + AllowOverride All + + # end site config + + + + # begin trac config + + SetHandler mod_python + PythonInterpreter main_interpreter + PythonHandler trac.web.modpython_frontend + PythonOption TracEnv <%= apache_sites_folder %>/$site/trac + PythonOption TracUriRoot /trac + + # This prevents strange behavior when using trac + # in the same virtual host with software that + # has rewrite rules in .htaccess, such as drupal + RewriteEngine off + + + + AuthType Basic + AuthName "Trac $site" + AuthUserFile <%= apache_sites_folder %>/$site/trac/auth/.htpasswd + Require valid-user + + # end trac config + + + + # begin moin config + Alias /moinroot /usr/share/moin/htdocs/ + # TODO: fastcgi + ScriptAlias /moin "<%= apache_sites_folder %>/$site/moin/cgi-bin/moin.cgi" + # end moin config + ScriptAlias /moin "<%= apache_sites_folder %>/$site/moin/cgi-bin/moin.cgi" + # end moin config + + + + # begin ikiwiki config + /$name/ikiwiki> + Options Indexes Includes FollowSymLinks MultiViews ExecCGI + AllowOverride All + + # end ikiwiki config + diff --git a/templates/website.erb b/templates/website.erb new file mode 100644 index 0000000..3398f60 --- /dev/null +++ b/templates/website.erb @@ -0,0 +1 @@ +# TODO: virtual host definition -- cgit v1.2.3