summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2013-12-28 17:26:14 +0100
committermh <mh@immerda.ch>2013-12-28 17:26:14 +0100
commit26e498007ae101aba154acc8435729768e9590ff (patch)
tree0eefb408589499a168a3c9713acf62b8dad05acf /manifests
parentc3a52f63c2a97b8d6135bd3131b36550d97d388a (diff)
reduce dependency on lsb modules, rather use the builtin facts
Diffstat (limited to 'manifests')
-rw-r--r--manifests/centos.pp6
-rw-r--r--manifests/config/file.pp30
-rw-r--r--manifests/debian.pp34
-rw-r--r--manifests/defaultphpdirs.pp6
-rw-r--r--manifests/vhost/file.pp63
-rw-r--r--manifests/vhost/file/documentrootfile.pp26
-rw-r--r--manifests/vhost/php/joomla.pp2
7 files changed, 89 insertions, 78 deletions
diff --git a/manifests/centos.pp b/manifests/centos.pp
index caf46ce..02adf77 100644
--- a/manifests/centos.pp
+++ b/manifests/centos.pp
@@ -28,12 +28,12 @@ class apache::centos inherits apache::package {
path => '/var/www/html/index.html',
}
- if $::selinux != 'false' {
+ if str2bool($::selinux) {
Selinux::Fcontext{
before => File[web_dir],
}
- $seltype_rw = $::lsbmajdistrelease ? {
- 5 => 'httpd_sys_script_rw_t',
+ $seltype_rw = $::operatingsystemmajrelease ? {
+ 5 => 'httpd_sys_script_rw_t',
default => 'httpd_sys_rw_content_t'
}
selinux::fcontext{
diff --git a/manifests/config/file.pp b/manifests/config/file.pp
index 308da68..29e6736 100644
--- a/manifests/config/file.pp
+++ b/manifests/config/file.pp
@@ -25,10 +25,12 @@ define apache::config::file(
default => $destination
}
file{"apache_${name}":
- ensure => $ensure,
- path => $real_destination,
- notify => Service[apache],
- owner => root, group => 0, mode => 0644;
+ ensure => $ensure,
+ path => $real_destination,
+ notify => Service[apache],
+ owner => root,
+ group => 0,
+ mode => '0644';
}
if $ensure == 'present' {
case $content {
@@ -37,10 +39,10 @@ define apache::config::file(
'absent' => [
"puppet:///modules/site_apache/${confdir}/${::fqdn}/${name}",
"puppet:///modules/site_apache/${confdir}/${apache::cluster_node}/${name}",
- "puppet:///modules/site_apache/${confdir}/${::operatingsystem}.${::lsbdistcodename}/${name}",
+ "puppet:///modules/site_apache/${confdir}/${::operatingsystem}.${::operatingsystemmajrelease}/${name}",
"puppet:///modules/site_apache/${confdir}/${::operatingsystem}/${name}",
"puppet:///modules/site_apache/${confdir}/${name}",
- "puppet:///modules/apache/${confdir}/${::operatingsystem}.${::lsbdistcodename}/${name}",
+ "puppet:///modules/apache/${confdir}/${::operatingsystem}.${::operatingsystemmajrelease}/${name}",
"puppet:///modules/apache/${confdir}/${::operatingsystem}/${name}",
"puppet:///modules/apache/${confdir}/${name}"
],
@@ -55,14 +57,14 @@ define apache::config::file(
'absent': {
$real_source = $source ? {
'absent' => [
- "puppet://${server}/modules/site-apache/${confdir}/${fqdn}/${name}",
- "puppet://${server}/modules/site-apache/${confdir}/${apache_cluster_node}/${name}",
- "puppet://${server}/modules/site-apache/${confdir}/${operatingsystem}.${lsbdistcodename}/${name}",
- "puppet://${server}/modules/site-apache/${confdir}/${operatingsystem}/${name}",
- "puppet://${server}/modules/site-apache/${confdir}/${name}",
- "puppet://${server}/modules/apache/${confdir}/${operatingsystem}.${lsbdistcodename}/${name}",
- "puppet://${server}/modules/apache/${confdir}/${operatingsystem}/${name}",
- "puppet://${server}/modules/apache/${confdir}/${name}"
+ "puppet:///modules/site-apache/${confdir}/${::fqdn}/${name}",
+ "puppet:///modules/site-apache/${confdir}/${apache::cluster_node}/${name}",
+ "puppet:///modules/site-apache/${confdir}/${::operatingsystem}.${::operatingsystemmajrelease}/${name}",
+ "puppet:///modules/site-apache/${confdir}/${::operatingsystem}/${name}",
+ "puppet:///modules/site-apache/${confdir}/${name}",
+ "puppet:///modules/apache/${confdir}/${::operatingsystem}.${::operatingsystemmajrelease}/${name}",
+ "puppet:///modules/apache/${confdir}/${::operatingsystem}/${name}",
+ "puppet:///modules/apache/${confdir}/${name}"
],
default => $source,
}
diff --git a/manifests/debian.pp b/manifests/debian.pp
index 345feae..7d1191d 100644
--- a/manifests/debian.pp
+++ b/manifests/debian.pp
@@ -3,36 +3,38 @@ class apache::debian inherits apache::package {
$config_dir = '/etc/apache2'
Package[apache] {
- name => 'apache2',
+ name => 'apache2',
}
File[vhosts_dir] {
- path => "${config_dir}/sites-enabled",
+ path => "${config_dir}/sites-enabled",
}
File[modules_dir] {
- path => "${config_dir}/mods-enabled",
+ path => "${config_dir}/mods-enabled",
}
File[htpasswd_dir] {
- path => "/var/www/htpasswds",
- group => 'www-data',
+ path => '/var/www/htpasswds',
+ group => 'www-data',
}
File[default_apache_index] {
- path => '/var/www/index.html',
+ path => '/var/www/index.html',
}
file { 'apache_main_config':
- path => "${config_dir}/apache2.conf",
- source => [ "puppet:///modules/site_apache/config/Debian/{$::fqdn}/apache2.conf",
- "puppet:///modules/site_apache/config/Debian.${::lsbdistcodename}/apache2.conf",
- "puppet:///modules/site_apache/config/Debian/apache2.conf",
- "puppet:///modules/apache/config/Debian/apache2.conf" ],
- require => Package['apache'],
- notify => Service['apache'],
- owner => root, group => 0, mode => 0644;
+ path => "${config_dir}/apache2.conf",
+ source => ["puppet:///modules/site_apache/config/Debian/${::fqdn}/apache2.conf",
+ "puppet:///modules/site_apache/config/Debian.${::operatingsystemmajrelease}/apache2.conf",
+ 'puppet:///modules/site_apache/config/Debian/apache2.conf',
+ 'puppet:///modules/apache/config/Debian/apache2.conf' ],
+ require => Package['apache'],
+ notify => Service['apache'],
+ owner => root,
+ group => 0,
+ mode => '0644';
}
apache::config::global{ 'charset': }
apache::config::global{ 'security': }
file { 'default_debian_apache_vhost':
- path => '/etc/apache2/sites-enabled/000-default',
- ensure => absent,
+ ensure => absent,
+ path => '/etc/apache2/sites-enabled/000-default',
}
}
diff --git a/manifests/defaultphpdirs.pp b/manifests/defaultphpdirs.pp
index 5485241..595744b 100644
--- a/manifests/defaultphpdirs.pp
+++ b/manifests/defaultphpdirs.pp
@@ -15,9 +15,9 @@ class apache::defaultphpdirs {
mode => '0755';
}
- if $::selinux != 'false' {
- $seltype_rw = $::lsbmajdistrelease ? {
- 5 => 'httpd_sys_script_rw_t',
+ if str2bool($::selinux) {
+ $seltype_rw = $::operatingsystemmajrelease ? {
+ 5 => 'httpd_sys_script_rw_t',
default => 'httpd_sys_rw_content_t'
}
selinux::fcontext{
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,'
},