summaryrefslogtreecommitdiff
path: root/manifests/vhost
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2012-12-13 15:30:14 +0100
committermh <mh@immerda.ch>2012-12-13 15:30:14 +0100
commit03fcb575adaee4678490c6ea577fdab94519d54e (patch)
treefcdaa1fa0b8e131b2c4f0cdb2a5b8edf60aa9b70 /manifests/vhost
parent56edcd00f3221fa713284c42110c7d3564f23ca1 (diff)
introduce anchor to hook into basic setup
Diffstat (limited to 'manifests/vhost')
-rw-r--r--manifests/vhost/webdir.pp205
1 files changed, 97 insertions, 108 deletions
diff --git a/manifests/vhost/webdir.pp b/manifests/vhost/webdir.pp
index e9eda1b..a6ec229 100644
--- a/manifests/vhost/webdir.pp
+++ b/manifests/vhost/webdir.pp
@@ -1,125 +1,114 @@
# create webdir
define apache::vhost::webdir(
- $ensure = present,
- $path = 'absent',
- $owner = root,
- $group = apache,
- $mode = 0640,
- $run_mode = 'normal',
- $manage_docroot = true,
- $documentroot_owner = root,
- $documentroot_group = apache,
- $documentroot_mode = 0640,
- $documentroot_recurse = false
+ $ensure = present,
+ $path = 'absent',
+ $owner = root,
+ $group = apache,
+ $mode = 0640,
+ $run_mode = 'normal',
+ $manage_docroot = true,
+ $documentroot_owner = root,
+ $documentroot_group = apache,
+ $documentroot_mode = 0640,
+ $documentroot_recurse = false
){
- $real_path = $path ? {
- 'absent' => $::operatingsystem ? {
- openbsd => "/var/www/htdocs/${name}",
- default => "/var/www/vhosts/${name}"
- },
- default => "${path}"
- }
+ $real_path = $path ? {
+ 'absent' => $::operatingsystem ? {
+ openbsd => "/var/www/htdocs/${name}",
+ default => "/var/www/vhosts/${name}"
+ },
+ default => $path
+ }
- if (($run_mode =~ /^(static\-|proxy\-)?itk$/) or $run_mode == 'fcgid') and ($mode == '0640'){
- $real_mode = 0644
- } else {
- $real_mode = $mode
- }
+ if (($run_mode =~ /^(static\-|proxy\-)?itk$/) or $run_mode == 'fcgid') and ($mode == '0640'){
+ $real_mode = 0644
+ } else {
+ $real_mode = $mode
+ }
- $documentroot = "${real_path}/www"
- $logdir = "${real_path}/logs"
+ $documentroot = "${real_path}/www"
+ $logdir = "${real_path}/logs"
- if $owner == 'apache' {
- if $apache_default_user == '' {
- $real_owner = $::operatingsystem ? {
- openbsd => 'www',
- debian => 'www-data',
- default => $owner
- }
- } else {
- $real_owner = $apache_default_user
- }
- } else {
- $real_owner = $owner
+ if $owner == 'apache' {
+ $real_owner = $::operatingsystem ? {
+ openbsd => 'www',
+ debian => 'www-data',
+ default => $owner
}
- if $group == 'apache' {
- if $apache_default_group == '' {
- $real_group = $::operatingsystem ? {
- openbsd => 'www',
- debian => 'www-data',
- default => $group
- }
- } else {
- $real_group = $apache_default_group
- }
- } else {
- $real_group = $group
+ } else {
+ $real_owner = $owner
+ }
+ if $group == 'apache' {
+ $real_group = $::operatingsystem ? {
+ openbsd => 'www',
+ debian => 'www-data',
+ default => $group
}
+ } else {
+ $real_group = $group
+ }
- if $documentroot_owner == 'apache' {
- if $apache_default_user == '' {
- $real_documentroot_owner = $::operatingsystem ? {
- openbsd => 'www',
- debian => 'www-data',
- default => $documentroot_owner
- }
- } else {
- $real_documentroot_owner = $apache_default_user
- }
- } else {
- $real_documentroot_owner = $documentroot_owner
+ if $documentroot_owner == 'apache' {
+ $real_documentroot_owner = $::operatingsystem ? {
+ openbsd => 'www',
+ debian => 'www-data',
+ default => $documentroot_owner
}
- if $documentroot_group == 'apache' {
- if $apache_default_group == '' {
- $real_documentroot_group = $::operatingsystem ? {
- openbsd => 'www',
- debian => 'www-data',
- default => $documentroot_group
- }
- } else {
- $real_documentroot_group = $apache_default_group
+ } else {
+ $real_documentroot_owner = $documentroot_owner
+ }
+ if $documentroot_group == 'apache' {
+ $real_documentroot_group = $::operatingsystem ? {
+ openbsd => 'www',
+ debian => 'www-data',
+ default => $documentroot_group
+ }
+ } else {
+ $real_documentroot_group = $documentroot_group
+ }
+ case $ensure {
+ absent: {
+ file{$real_path:
+ ensure => absent,
+ purge => true,
+ recurse => true,
+ force => true;
}
- } else {
- $real_documentroot_group = $documentroot_group
}
- case $ensure {
- absent: {
- if $manage_docroot {
- $managed_directories = [ $real_path, "${real_path}/private", $logdir, $documentroot ]
- } else {
- $managed_directories = [ $real_path, "${real_path}/private", $logdir ]
- }
- file{$managed_directories:
- ensure => absent,
- purge => true,
- recurse => true,
- force => true,
- }
+ default: {
+ file{
+ $real_path:
+ ensure => directory,
+ require => Anchor['apache::basic_dirs::ready'],
+ owner => $real_owner,
+ group => $real_group,
+ mode => $real_mode;
+ $logdir:
+ ensure => directory,
+ owner => $real_documentroot_owner,
+ group => $real_documentroot_group,
+ mode => '0660';
+ "${real_path}/private":
+ ensure => directory,
+ owner => $real_documentroot_owner,
+ group => $real_documentroot_group,
+ mode => '0600';
+ }
+ if $manage_docroot {
+ file{$documentroot:
+ ensure => directory,
+ recurse => $documentroot_recurse,
+ owner => $real_documentroot_owner,
+ group => $real_documentroot_group,
+ mode => $documentroot_mode;
}
- default: {
- file{$real_path:
- ensure => directory,
- owner => $real_owner, group => $real_group, mode => $real_mode;
- }
- if $manage_docroot {
- file{$documentroot:
- ensure => directory,
- recurse => $documentroot_recurse,
- owner => $real_documentroot_owner, group => $real_documentroot_group, mode => $documentroot_mode;
- }
- }
- file{"$logdir":
- ensure => directory,
- owner => $real_documentroot_owner, group => $real_documentroot_group, mode => 0660;
- }
- case $::operatingsystem {
- centos: { include apache::logrotate::centos::vhosts }
- }
- file{"${real_path}/private":
- ensure => directory,
- owner => $real_documentroot_owner, group => $real_documentroot_group, mode => 0600;
- }
+ }
+ case $::operatingsystem {
+ centos: { include apache::logrotate::centos::vhosts }
+ default: { #nothing
}
+ }
}
+ }
}