X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fapache2%2Fmanifests%2Fconfig.pp;h=4faa33f156a3525eaa66c9bc2efac3c5bdf97c2c;hb=8e2327eb70f1d7afce481638cd797c7d4b607cef;hp=5d5170046959a70697872dbbd411a380c4059b80;hpb=3eb533e5499e66423bafdedaf6c7d08ead1772de;p=mirror%2Fdsa-puppet.git diff --git a/modules/apache2/manifests/config.pp b/modules/apache2/manifests/config.pp index 5d5170046..4faa33f15 100644 --- a/modules/apache2/manifests/config.pp +++ b/modules/apache2/manifests/config.pp @@ -1,30 +1,63 @@ -define apache2::config($config = undef, $template = undef, $ensure = present) { +define apache2::config ( + $source=undef, + $content=undef, + $ensure=present +) { include apache2 - if ! ($config or $template) { - err ( "No configuration found for ${name}" ) - } - case $ensure { - present: {} + present: { + if ! ($source or $content) { + fail ( "No configuration found for ${name}" ) + } + } absent: {} - default: { err ( "Unknown ensure value: '$ensure'" ) } + default: { fail ( "Unknown ensure value: '$ensure'" ) } } - if $template { - file { "/etc/apache2/conf.d/${name}": - ensure => $ensure, - content => template($template), - require => Package['apache2'], - notify => Service['apache2'], + if $::lsbmajdistrelease <= 7 { + if $content { + file { "/etc/apache2/conf.d/${name}": + ensure => $ensure, + content => $content, + require => Package['apache2'], + notify => Service['apache2'], + } + } else { + file { "/etc/apache2/conf.d/${name}": + ensure => $ensure, + source => $source, + require => Package['apache2'], + notify => Service['apache2'], + } } } else { - file { "/etc/apache2/conf.d/${name}": - ensure => $ensure, - source => $config, - require => Package['apache2'], - notify => Service['apache2'], + if $content { + file { "/etc/apache2/conf-available/${name}.conf": + ensure => $ensure, + content => $content, + require => Package['apache2'], + notify => Service['apache2'], + } + } else { + file { "/etc/apache2/conf-available/${name}.conf": + ensure => $ensure, + source => $source, + require => Package['apache2'], + notify => Service['apache2'], + } + } + + $link_ensure = $ensure ? { + present => link, + absent => absent + } + + file { "/etc/apache2/conf-enabled/${name}.conf": + ensure => $link_ensure, + target => "../conf-available/${name}.conf", + notify => Service['apache2'], } } }