From 26e498007ae101aba154acc8435729768e9590ff Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 28 Dec 2013 17:26:14 +0100 Subject: reduce dependency on lsb modules, rather use the builtin facts --- manifests/vhost/file.pp | 63 +++++++++++++++++--------------- manifests/vhost/file/documentrootfile.pp | 26 +++++++------ manifests/vhost/php/joomla.pp | 2 +- 3 files changed, 49 insertions(+), 42 deletions(-) (limited to 'manifests/vhost') diff --git a/manifests/vhost/file.pp b/manifests/vhost/file.pp index b42c4ce..9155cfc 100644 --- a/manifests/vhost/file.pp +++ b/manifests/vhost/file.pp @@ -33,42 +33,45 @@ # - semianonym: Don't log ips for CustomLog, log normal ErrorLog # # -# mod_security: Whether we use mod_security or not (will include mod_security module) +# mod_security: Whether we use mod_security or not +# (will include mod_security module) # - false: (*default*) don't activate mod_security # - true: activate mod_security # define apache::vhost::file( - $ensure = present, - $vhost_source = 'absent', - $vhost_destination = 'absent', - $content = 'absent', - $do_includes = false, - $run_mode = 'normal', - $logmode = 'default', - $ssl_mode = false, - $mod_security = false, - $htpasswd_file = 'absent', - $htpasswd_path = 'absent', - $use_mod_macro = false + $ensure = present, + $vhost_source = 'absent', + $vhost_destination = 'absent', + $content = 'absent', + $do_includes = false, + $run_mode = 'normal', + $logmode = 'default', + $ssl_mode = false, + $mod_security = false, + $htpasswd_file = 'absent', + $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", + 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", - default => $vhost_destination, + 'absent' => "${vhosts_dir}/${name}.conf", + default => $vhost_destination, } file{"${name}.conf": - ensure => $ensure, - path => $real_vhost_destination, + ensure => $ensure, + path => $real_vhost_destination, require => File[vhosts_dir], - notify => Service[apache], - owner => root, group => 0, mode => 0644; + notify => Service[apache], + owner => root, + group => 0, + mode => '0644'; } if $ensure != 'absent' { if $do_includes { @@ -98,12 +101,12 @@ 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/{::fqdn}/${name}.conf", + "puppet:///modules/site_apache/vhosts.d/${apache::cluster_node}/${name}.conf", + "puppet:///modules/site_apache/vhosts.d/${::operatingsystem}.${::operatingsystemmajrelease}/${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}.${::operatingsystemmajrelease}/${name}.conf", "puppet:///modules/apache/vhosts.d/${::operatingsystem}/${name}.conf", "puppet:///modules/apache/vhosts.d/${name}.conf" ], @@ -133,10 +136,12 @@ define apache::vhost::file( } if ($ensure!='absent') { File[$real_htpasswd_path]{ - source => [ "puppet:///modules/site_apache/htpasswds/${::fqdn}/${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, + owner => root, + group => 0, + mode => '0644', } } } diff --git a/manifests/vhost/file/documentrootfile.pp b/manifests/vhost/file/documentrootfile.pp index 610d71c..c5bc72a 100644 --- a/manifests/vhost/file/documentrootfile.pp +++ b/manifests/vhost/file/documentrootfile.pp @@ -1,25 +1,27 @@ +# place a file in the documentroot define apache::vhost::file::documentrootfile( - $documentroot, - $filename, - $thedomain, - $owner='root', - $group='0', - $mode=440 + $documentroot, + $filename, + $thedomain, + $owner = 'root', + $group = '0', + $mode = '0440', ){ 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}.${::operatingsystemmajrelease}/${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}.${::operatingsystemmajrelease}/${thedomain}/${filename}", "puppet:///modules/apache/vhost_varieties/${::operatingsystem}/${thedomain}/${filename}", - "puppet:///modules/apache/vhost_varieties/${thedomain}/${filename}" - ], - ensure => file, + "puppet:///modules/apache/vhost_varieties/${thedomain}/${filename}", + ], require => Apache::Vhost::Webdir[$thedomain], - owner => $owner, group => $group, mode => $mode; + owner => $owner, + group => $group, + mode => $mode; } } diff --git a/manifests/vhost/php/joomla.pp b/manifests/vhost/php/joomla.pp index 78b392e..30282e2 100644 --- a/manifests/vhost/php/joomla.pp +++ b/manifests/vhost/php/joomla.pp @@ -73,7 +73,7 @@ define apache::vhost::php::joomla( if $mod_security_additional_options == 'absent' { $id_str = $::operatingsystem ? { - 'CentOS' => $::lsbmajdistrelease ? { + 'CentOS' => $::operatingsystemmajrelease ? { 5 => '', default => 'id:1199400,' }, -- cgit v1.2.3