First attempt at making apache conf stuff work on jessie
authorPeter Palfrader <peter@palfrader.org>
Tue, 23 Dec 2014 12:11:16 +0000 (13:11 +0100)
committerPeter Palfrader <peter@palfrader.org>
Tue, 23 Dec 2014 12:11:16 +0000 (13:11 +0100)
modules/apache2/manifests/config.pp

index 9a11115..f44dc01 100644 (file)
@@ -16,19 +16,48 @@ define apache2::config (
                default: { fail ( "Unknown ensure value: '$ensure'" ) }
        }
 
-       if $content {
-               file { "/etc/apache2/conf.d/${name}":
-                       ensure  => $ensure,
-                       content => $content,
-                       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  => $source,
-                       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 ? {
+                       present => 'link',
+                       absent  => 'absent'
+               }
+
+               file { "/etc/apache2/conf-enabled/${name}":
+                       ensure => $link_ensure,
+                       target => "/etc/apache2/conf-available/${base}.conf",
+                       notify => Service['apache2'],
                }
        }
 }