]> gitweb.fluxo.info Git - puppet-lighttpd.git/commitdiff
register additional configs
authormh <mh@immerda.ch>
Sun, 21 Oct 2012 11:11:55 +0000 (13:11 +0200)
committermh <mh@immerda.ch>
Sun, 21 Oct 2012 11:11:55 +0000 (13:11 +0200)
manifests/base.pp
manifests/config/file.pp
manifests/init.pp

index 33acefda08bff90dc308c23792f2c55bd5b979ba..0f942a58205f82af3ccef3f62284ccf8383273a8 100644 (file)
@@ -1,36 +1,50 @@
+# manages the base stuff of
+# a lighttpd server
 class lighttpd::base {
   package{'lighttpd':
     ensure => installed,
   }
 
-  service{lighttpd:
-    ensure => running,
-    enable => true,
+  service{'lighttpd':
+    ensure    => running,
+    enable    => true,
     hasstatus => true,
-    require => Package[lighttpd],
+    require   => Package['lighttpd'],
   }
 
-  file{'/etc/lighttpd/lighttpd.conf':
-    source => [ "puppet:///modules/site_lighttpd/${::fqdn}/lighttpd.conf",
-                "puppet:///modules/site_lighttpd/lighttpd.conf",
-                "puppet:///modules/lighttpd/${::operatingsystem}/lighttpd.conf",
-                "puppet:///modules/lighttpd/lighttpd.conf" ],
-    require => Package['lighttpd'],
-    notify => Service['lighttpd'],
-    owner => root, group => 0, mode => 0644;
-  }
-
-  # ToDo: put that in a common module to share with apache
-  file { 'default_lighttpd_index':
-    path => '/var/www/lighttpd/index.html',
-    ensure => file,
-    content => template('lighttpd/default/default_index.erb'),
-    owner => root, group => 0, mode => 0644;
-  }
-
-  file{'/etc/cron.daily/clean_lighttpd_compress':
-    content => "find /var/cache/lighttpd/compress -type f -mtime +10 | xargs -r rm\n",
-    require => Package['lighttpd'],
-    owner => root, group => 0, mode => 0640;
+  file{
+    '/etc/lighttpd/lighttpd.conf':
+      source  => [  "puppet:///modules/site_lighttpd/${::fqdn}/lighttpd.conf",
+                    'puppet:///modules/site_lighttpd/lighttpd.conf',
+                    "puppet:///modules/lighttpd/${::operatingsystem}/lighttpd.conf",
+                    'puppet:///modules/lighttpd/lighttpd.conf' ],
+      require => Package['lighttpd'],
+      notify  => Service['lighttpd'],
+      owner   => 'root',
+      group   => 0,
+      mode    => '0644';
+    # ToDo: put that in a common module to share with apache
+    'default_lighttpd_index':
+      ensure  => file,
+      path    => '/var/www/lighttpd/index.html',
+      content => template('lighttpd/default/default_index.erb'),
+      require => Package['lighttpd'],
+      before  => Service['lighttpd'],
+      owner   => 'root',
+      group   => 0,
+      mode    => '0644';
+    "${lighttpd::conf_dir}/config.conf":
+      ensure  => file,
+      require => Package['lighttpd'],
+      before  => Service['lighttpd'],
+      owner   => 'root',
+      group   => 0,
+      mode    => '0644';
+    '/etc/cron.daily/clean_lighttpd_compress':
+      content => "find /var/cache/lighttpd/compress -type f -mtime +10 | xargs -r rm\n",
+      require => Package['lighttpd'],
+      owner   => 'root',
+      group   => 0,
+      mode    => '0640';
   }
 }
index 812a737e3d95276bf7ba1087fa6e516f201d39ad..e03f3c008ba7b7b4f33f6ec26bc9b00615739430 100644 (file)
@@ -4,12 +4,7 @@ define lighttpd::config::file(
   $conf_source = 'absent',
   $content = 'absent'
 ){
-  $conf_dir = $::operatingsystem ? {
-    debian  => '/etc/lighttpd/conf-available',
-    ubuntu  => '/etc/lighttpd/conf-available',
-    default => '/etc/lighttpd/conf.d'
-  }
-  file{"${conf_dir}/${name}.conf":
+  file{"${lighttpd::conf_dir_name}/${name}.conf":
     ensure  => $ensure,
     require => Package['lighttpd'],
     notify  => Service['lighttpd'],
@@ -18,27 +13,34 @@ define lighttpd::config::file(
     mode    => '0644';
   }
 
+  file_line{$name:
+    ensure  => $ensure,
+    path    => "${lighttpd::conf_dir_name}/config.conf",
+    line    => "include \"${lighttpd::conf_dir_name}/${name}.conf\"",
+    notify  => Service['lighttpd'],
+  }
+
   case $content {
     'absent': {
-      File["${conf_dir}/${name}.conf"]{
+      File["${lighttpd::conf_dir_name}/${name}.conf"]{
         source => $conf_source ? {
           'absent'  => [
-            "puppet:///modules/site_lighttpd/conf.d/${::fqdn}/${name}.conf",
-            "puppet:///modules/site_lighttpd/conf.d/${lighttpd::cluster_node}/${name}.conf",
-            "puppet:///modules/site_lighttpd/conf.d/${::operatingsystem}.${::lsbdistcodename}/${name}.conf",
-            "puppet:///modules/site_lighttpd/conf.d/${::operatingsystem}/${name}.conf",
-            "puppet:///modules/site_lighttpd/conf.d/${name}.conf",
-            "puppet:///modules/lighttpd/conf.d/${name}.conf",
-            "puppet:///modules/lighttpd/conf.d/${::operatingsystem}.${::lsbdistcodename}/${name}.conf",
-            "puppet:///modules/lighttpd/conf.d/${::operatingsystem}/${name}.conf",
-            "puppet:///modules/lighttpd/conf.d/${name}.conf"
+            "puppet:///modules/site_lighttpd/${lighttpd::conf_dir_name}/${::fqdn}/${name}.conf",
+            "puppet:///modules/site_lighttpd/${lighttpd::conf_dir_name}/${lighttpd::cluster_node}/${name}.conf",
+            "puppet:///modules/site_lighttpd/${lighttpd::conf_dir_name}/${::operatingsystem}.${::lsbdistcodename}/${name}.conf",
+            "puppet:///modules/site_lighttpd/${lighttpd::conf_dir_name}/${::operatingsystem}/${name}.conf",
+            "puppet:///modules/site_lighttpd/${lighttpd::conf_dir_name}/${name}.conf",
+            "puppet:///modules/lighttpd/${lighttpd::conf_dir_name}/${name}.conf",
+            "puppet:///modules/lighttpd/${lighttpd::conf_dir_name}/${::operatingsystem}.${::lsbdistcodename}/${name}.conf",
+            "puppet:///modules/lighttpd/${lighttpd::conf_dir_name}/${::operatingsystem}/${name}.conf",
+            "puppet:///modules/lighttpd/${lighttpd::conf_dir_name}/${name}.conf"
           ],
         default => "puppet:///${conf_source}",
         }
       }
     }
     default: {
-      File["${conf_dir}/${name}.conf"]{
+      File["${lighttpd::conf_dir_name}/${name}.conf"]{
         content => $content,
       }
     }
index 767f89be4728c9cf984aa7b0699536ffe7067b29..c4b84bda1bc89947b71b85befaede133737145c6 100644 (file)
@@ -7,6 +7,15 @@ class lighttpd(
   $manage_munin     = false,
   $manage_shorewall = false
 ) {
+
+  $conf_dir_name =  $::operatingsystem ? {
+    debian  => 'conf-available',
+    ubuntu  => 'conf-available',
+    default => 'conf.d'
+  }
+
+  $conf_dir = "/etc/lighttpd/${conf_dir_name}"
+
   case $::operatingsystem {
     debian,ubuntu: { include lighttpd::debian }
     centos,redhat,fedora: { include lighttpd::centos }