]> gitweb.fluxo.info Git - puppet-lighttpd.git/commitdiff
new style for 2.7
authormh <mh@immerda.ch>
Tue, 5 Jun 2012 23:07:08 +0000 (20:07 -0300)
committermh <mh@immerda.ch>
Tue, 5 Jun 2012 23:07:08 +0000 (20:07 -0300)
manifests/base.pp
manifests/config/file.pp
manifests/init.pp
manifests/ssl.pp
manifests/vhost/file.pp
templates/default/default_index.erb

index 3880b2e5de6e32eab1d5e48b98eb728a365fa062..33acefda08bff90dc308c23792f2c55bd5b979ba 100644 (file)
@@ -6,14 +6,14 @@ class lighttpd::base {
   service{lighttpd:
     ensure => running,
     enable => true,
-    hasstatus => true, 
+    hasstatus => true,
     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",
+    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'],
index 7d44780caba5bae4aa7ba79d7115f1bfc595eeaf..c7038340f5cb56fa7ac15a1dfe1608076bab9925 100644 (file)
@@ -3,7 +3,7 @@ define lighttpd::config::file(
   $conf_source = 'absent',
   $content = 'absent'
 ){
-  $conf_dir = $operatingsystem ? {
+  $conf_dir = $::operatingsystem ? {
     debian => '/etc/lighttpd/conf-available',
     ubuntu => '/etc/lighttpd/conf-available',
     default => '/etc/lighttpd/conf.d'
@@ -19,15 +19,15 @@ define lighttpd::config::file(
       File["${conf_dir}/${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/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"
           ],
         default => "puppet:///$conf_source",
         }
index 9ec22fbf45989e15a94495653d081f66ec5c79df..d8fd745fab0b9cdcafeef4e79aa8759bcc387342 100644 (file)
@@ -2,17 +2,19 @@
 # Copyright (C) 2007 admin@immerda.ch
 # GPLv3
 
-class lighttpd {
-  case $operatingsystem {
+class lighttpd(
+  $cluster_node = hiera('lighttpd_cluster_node','some_cluster_node')
+) {
+  case $::operatingsystem {
     debian,ubuntu: { include lighttpd::debian }
     centos,redhat,fedora: { include lighttpd::centos }
     default: { include lighttpd::base }
   }
 
-  if $use_shorewall {
+  if hiera('use_shorewall',false) {
     include shorewall::rules::http
   }
-  if $use_munin {
+  if hiera('use_munin',false) {
     include lighttpd::munin
   }
 }
index efa677ea9cc16eff6a8f33edbb61ac8ded8a77c0..deb464cdb573d5ec52a4e9f65e1224f32bd99924 100644 (file)
@@ -1,6 +1,6 @@
 class lighttpd::ssl inherits lighttpd {
   lighttpd::config::file{ 'ssl': }
-  if $use_shorewall {
+  if hiera('use_shorewall',false) {
     include shorewall::rules::https
   }
 }
index 054a530497b315edaa954e846aa1e23af773b2ca..c3f82c12cbdcbaaf86df7903c1f45f072a4eb241 100644 (file)
@@ -3,35 +3,32 @@ define lighttpd::vhost::file(
     $vhost_source = 'absent',
     $content = 'absent'
 ){
-    include ::lighttpd::vhosts
-    file{"/etc/lighttpd/vhosts.d/${name}.conf":
-        ensure => $ensure,
-        notify => Service['lighttpd'],
-        owner => root, group => 0, mode => 0644;
-    }
+  include ::lighttpd::vhosts
+  file{"/etc/lighttpd/vhosts.d/${name}.conf":
+    ensure => $ensure,
+    notify => Service['lighttpd'],
+    owner => root, group => 0, mode => 0644;
+  }
 
-    case $content {
-        'absent': {
-            File["/etc/lighttpd/vhosts.d/${name}.conf"]{
-                source => $vhost_source ? {
-                  'absent'  => [
-                    "puppet:///modules/site-lighttpd/vhosts.d/$fqdn/$name.conf",
-                    "puppet:///modules/site-lighttpd/vhosts.d/$lighttpd_cluster_node/$name.conf",
-                    "puppet:///modules/site-lighttpd/vhosts.d/$operatingsystem.$lsbdistcodename/$name.conf",
-                    "puppet:///modules/site-lighttpd/vhosts.d/$operatingsystem/$name.conf",
-                    "puppet:///modules/site-lighttpd/vhosts.d/$name.conf",
-                    "puppet:///modules/lighttpd/vhosts.d/$operatingsystem.$lsbdistcodename/$name.conf",
-                    "puppet:///modules/lighttpd/vhosts.d/$operatingsystem/$name.conf",
-                    "puppet:///modules/lighttpd/vhosts.d/$name.conf"
-                  ],
-                  default => "puppet:///$vhost_source",
-              }
-            }
-        }
-        default: {
-            File["/etc/lighttpd/vhosts.d/${name}.conf"]{
-                content => $content,
-            }
+  case $content {
+    'absent': {
+      File["/etc/lighttpd/vhosts.d/${name}.conf"]{
+        source => $vhost_source ? {
+          'absent'  => [
+            "puppet:///modules/site_lighttpd/vhosts.d/${::fqdn}/${name}.conf",
+            "puppet:///modules/site_lighttpd/vhosts.d/${lighttpd::cluster_node}/${name}.conf",
+            "puppet:///modules/site_lighttpd/vhosts.d/${::operatingsystem}.${::lsbdistcodename}/${name}.conf",
+            "puppet:///modules/site_lighttpd/vhosts.d/${::operatingsystem}/${name}.conf",
+            "puppet:///modules/site_lighttpd/vhosts.d/${name}.conf"
+          ],
+          default => "puppet:///${vhost_source}",
         }
+      }
+    }
+    default: {
+      File["/etc/lighttpd/vhosts.d/${name}.conf"]{
+        content => $content,
+      }
     }
+  }
 }
index 844ad0421e5bfda37f02423422cea605902862c5..f5058e73b4492b4350da2f3483176c17292ba6f6 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 <head>
-  <title><%= hostname %></title>
+  <title><%= scope.lookupvar('::hostname') %></title>
   <meta http-equiv="content-type" content="text/html; charset=utf-8" />
 </head>
 <body>
@@ -12,7 +12,7 @@
      alt="Valid XHTML 1.0 Strict" height="31" width="88" style="border: 0;" /></a>
 </p>
 <p>
-  <small><em><%= hostname %></em></small>
+  <small><em><%= scope.lookupvar('::hostname') %></em></small>
 </p>
 </body>
 </html>