X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fapache2%2Fmanifests%2Fconfig.pp;h=4faa33f156a3525eaa66c9bc2efac3c5bdf97c2c;hb=184619433f4bd137cef8fc1454516258dd6541b2;hp=b67ddbee75e5ccdb864abf8874dfab4ef81f20ad;hpb=175c9bc26de888ba32a7677aa393621425d595f5;p=mirror%2Fdsa-puppet.git diff --git a/modules/apache2/manifests/config.pp b/modules/apache2/manifests/config.pp index b67ddbee7..4faa33f15 100644 --- a/modules/apache2/manifests/config.pp +++ b/modules/apache2/manifests/config.pp @@ -1,10 +1,14 @@ -define apache2::config($config = undef, $template = undef, $ensure = present) { +define apache2::config ( + $source=undef, + $content=undef, + $ensure=present +) { include apache2 case $ensure { present: { - if ! ($config or $template) { + if ! ($source or $content) { fail ( "No configuration found for ${name}" ) } } @@ -12,19 +16,48 @@ define apache2::config($config = undef, $template = undef, $ensure = present) { 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'], } } }