From 9e3ff494ae29c94f9c4d63a69939b564ce03c088 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 1 Mar 2008 15:06:45 +0000 Subject: moved file definition and so on --- manifests/init.pp | 71 ++++++++++++++++++++++--------------------------------- 1 file changed, 28 insertions(+), 43 deletions(-) (limited to 'manifests/init.pp') diff --git a/manifests/init.pp b/manifests/init.pp index cbe111a..82864b1 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -10,33 +10,19 @@ class apache { ubuntu: { include apache::ubuntu } default: { include apache::base } } +} - #include apache::gentoo - -# $vhosts_dir = $operatingsystem ? { -# centos => "$apache::centos::config_dir/vhosts.d/", -# gentoo => "$apache::gentoo::config_dir/vhosts.d/", -# debian => "$apache::debian::config_dir/vhosts.d/", -# ubuntu => "$apache::ubuntu::config_dir/vhosts.d/", -# openbsd => "$apache::openbsd::config_dir/vhosts.d/", -# default => '/etc/apache2/vhosts.d/', -# } - - $vhosts_dir = "$config_dir/vhosts.d/" - -notice("vhosts_dir=${vhosts_dir}") +class apache::base { - file{ - $vhosts_dir: + file{'vhosts_dir': + path => '/etc/apache2/vhosts.d/', ensure => directory, owner => root, group => 0, mode => 0755, require => Package[apache], } -} -class apache::base { package { 'apache': name => 'apache', ensure => present, @@ -63,6 +49,7 @@ class apache::base { ### distro specific stuff class apache::centos inherits apache::base{ + $config_dir = '/etc/httpd/' Package[apache]{ name => 'httpd', } @@ -74,25 +61,31 @@ class apache::centos inherits apache::base{ ensure => present, require => Package[apache], } - File[default_apache_index]{ path => '/var/www/html/index.html', } - $config_dir = '/etc/httpd/' + File[vhosts_dir]{ + path => "$config_dir/vhosts.d/", + } } class apache::gentoo inherits apache::base { # $config_dir = '/etc/apache2/' + + # needs module gentoo + gentoo::etcconfd { apache2: } + Package[apache]{ category => 'www-servers', } - # needs module gentoo - gentoo::etcconfd { apache2: } + File[vhosts_dir]{ + path => "$config_dir/vhosts.d/", + } } class apache::debian inherits apache::base { $config_dir = '/etc/apache2/' - file {"${config_dir}/vhosts.d/": + file {"vhosts_dir": ensure => '/etc/apache2/sites-enabled/', } } @@ -100,6 +93,9 @@ class apache::debian inherits apache::base { class apache::ubuntu inherits apache::debian {} class apache::openbsd inherits apache::base { $config_dir = '/var/www/conf/' + File[vhosts_dir]{ + path => "$config_dir/vhosts.d/", + } } @@ -108,26 +104,15 @@ define apache::vhost::file( $source = '', $destination = '' ){ - $vhosts_dir = "$config_dir/vhosts.d/" -notice("vhosts_dir_vhost::file=${vhosts_dir}") -# $vhosts_dir = $operatingsystem ? { -# centos => "$apache::centos::config_dir/vhosts.d/", -# gentoo => "$apache::gentoo::config_dir/vhosts.d/", -# debian => "$apache::debian::config_dir/vhosts.d/", -# ubuntu => "$apache::ubuntu::config_dir/vhosts.d/", -# openbsd => "$apache::openbsd::config_dir/vhosts.d/", -# default => '/etc/apache2/vhosts.d/', -# } -# -# file{ -# $vhosts_dir: -# ensure => directory, -# owner => root, -# group => 0, -# mode => 0755, -# require => Package[apache], -# } - + $vhosts_dir = $operatingsystem ? { + centos => "$apache::centos::config_dir/vhosts.d/", + gentoo => "$apache::gentoo::config_dir/vhosts.d/", + debian => "$apache::debian::config_dir/vhosts.d/", + ubuntu => "$apache::ubuntu::config_dir/vhosts.d/", + openbsd => "$apache::openbsd::config_dir/vhosts.d/", + default => '/etc/apache2/vhosts.d/', + } + $real_destination = $destination ? { '' => "${vhosts_dir}/${name}.conf", default => $destination, -- cgit v1.2.3