summaryrefslogtreecommitdiff
path: root/manifests/config/file.pp
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2015-04-17 15:32:01 -0400
committerMicah Anderson <micah@riseup.net>2015-04-17 15:32:01 -0400
commit36fd84c3d17355afa05b519764c37a3e45efc40d (patch)
treec6f5dbc4651875a147607c788b37c5c973573330 /manifests/config/file.pp
parentffa03fb9f13bcd78b7e22f47b224c5a7244328ef (diff)
parent8074127b8d8913314c90c3fe6131d078a858f7b6 (diff)
Merge remote-tracking branch 'immerda/master'
Diffstat (limited to 'manifests/config/file.pp')
-rw-r--r--manifests/config/file.pp154
1 files changed, 89 insertions, 65 deletions
diff --git a/manifests/config/file.pp b/manifests/config/file.pp
index 947ce96..7b05869 100644
--- a/manifests/config/file.pp
+++ b/manifests/config/file.pp
@@ -1,82 +1,106 @@
# deploy apache configuration file
# by default we assume it's a global configuration file
define apache::config::file(
- $ensure = present,
- $target = false,
- $type = 'global',
- $source = 'absent',
- $content = 'absent',
- $destination = 'absent'
+ $ensure = present,
+ $target = false,
+ $type = 'global',
+ $source = 'absent',
+ $content = 'absent',
+ $destination = 'absent'
){
- case $type {
- 'include': { $confdir = 'include.d' }
- 'global': { $confdir = 'conf.d' }
- default: { fail("Wrong config file type specified for ${name}") }
- }
- $real_destination = $destination ? {
- 'absent' => $::operatingsystem ? {
- centos => "${apache::centos::config_dir}/${confdir}/${name}",
- gentoo => "${apache::gentoo::config_dir}/${name}",
- debian => "${apache::debian::config_dir}/${confdir}/${name}",
- ubuntu => "${apache::ubuntu::config_dir}/${confdir}/${name}",
- openbsd => "${apache::openbsd::config_dir}/${confdir}/${name}",
- default => "/etc/apache2/${confdir}/${name}",
- },
- default => $destination
- }
- file{"apache_${name}":
- ensure => $ensure,
- path => $real_destination,
- notify => Service[apache],
- owner => root, group => 0, mode => 0644;
- }
+ case $type {
+ 'include': { $confdir = 'include.d' }
+ 'global': { $confdir = 'conf.d' }
+ default: { fail("Wrong config file type specified for ${name}") }
+ }
+ $real_destination = $destination ? {
+ 'absent' => $::operatingsystem ? {
+ centos => "${apache::centos::config_dir}/${confdir}/${name}",
+ gentoo => "${apache::gentoo::config_dir}/${name}",
+ debian => "${apache::debian::config_dir}/${confdir}/${name}",
+ ubuntu => "${apache::ubuntu::config_dir}/${confdir}/${name}",
+ openbsd => "${apache::openbsd::config_dir}/${confdir}/${name}",
+ default => "/etc/apache2/${confdir}/${name}",
+ },
+ default => $destination
+ }
+ file{"apache_${name}":
+ ensure => $ensure,
+ path => $real_destination,
+ notify => Service[apache],
+ owner => root,
+ group => 0,
+ mode => '0644';
+ }
- case $ensure {
- 'absent', 'purged': {
- # We want to avoid all stuff related to source and content
+ case $ensure {
+ 'absent', 'purged': {
+ # We want to avoid all stuff related to source and content
+ }
+ 'link': {
+ if $target {
+ File["apache_${name}"] {
+ target => $target,
+ }
}
- 'link': {
- if $target != false {
- File["apache_${name}"] {
- target => $target,
+ }
+ default: {
+ case $content {
+ 'absent': {
+ $real_source = $source ? {
+ 'absent' => [
+ "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
+ }
+ File["apache_${name}"]{
+ source => $real_source,
}
}
- }
- default: {
- case $content {
- 'absent': {
- $real_source = $source ? {
- '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}/${name}",
- "puppet:///modules/site_apache/${confdir}/${name}",
- "puppet:///modules/apache/${confdir}/${::operatingsystem}.${::lsbdistcodename}/${name}",
- "puppet:///modules/apache/${confdir}/${::operatingsystem}/${name}",
- "puppet:///modules/apache/${confdir}/${name}"
- ],
- default => $source,
- }
- File["apache_${name}"]{
- source => $real_source,
+ default: {
+ case $content {
+ 'absent': {
+ $real_source = $source ? {
+ 'absent' => [
+ "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,
+ }
+ File["apache_${name}"]{
+ source => $real_source,
+ }
}
- }
- default: {
- File["apache_${name}"]{
- content => $content,
+ default: {
+ File["apache_${name}"]{
+ content => $content,
+ }
}
}
}
}
}
+ }
- case $::operatingsystem {
- openbsd: { info("no package dependency on ${::operatingsystem} for ${name}") }
- default: {
- File["apache_${name}"]{
- require => Package[apache],
- }
- }
+ case $::operatingsystem {
+ openbsd: { info("no package dependency on ${::operatingsystem} for ${name}") }
+ default: {
+ File["apache_${name}"]{
+ require => Package[apache],
+ }
}
+ }
}