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 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 2 deletions(-) (limited to 'manifests/init.pp') 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"], + } + } +} -- cgit v1.2.3