summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2012-06-05 20:07:08 -0300
committermh <mh@immerda.ch>2012-06-05 20:07:08 -0300
commit09b77138a3cf505e82f1d5a8d20f794fe1db8434 (patch)
tree4be47d1fd07bc56b412c5ace110d5bd080375757
parentdbf5334ff24a3b94d52520a86c365c0227863a56 (diff)
downloadpuppet-lighttpd-09b77138a3cf505e82f1d5a8d20f794fe1db8434.tar.gz
puppet-lighttpd-09b77138a3cf505e82f1d5a8d20f794fe1db8434.tar.bz2
new style for 2.7
-rw-r--r--manifests/base.pp8
-rw-r--r--manifests/config/file.pp20
-rw-r--r--manifests/init.pp10
-rw-r--r--manifests/ssl.pp2
-rw-r--r--manifests/vhost/file.pp53
-rw-r--r--templates/default/default_index.erb4
6 files changed, 48 insertions, 49 deletions
diff --git a/manifests/base.pp b/manifests/base.pp
index 3880b2e..33acefd 100644
--- a/manifests/base.pp
+++ b/manifests/base.pp
@@ -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'],
diff --git a/manifests/config/file.pp b/manifests/config/file.pp
index 7d44780..c703834 100644
--- a/manifests/config/file.pp
+++ b/manifests/config/file.pp
@@ -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",
}
diff --git a/manifests/init.pp b/manifests/init.pp
index 9ec22fb..d8fd745 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -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
}
}
diff --git a/manifests/ssl.pp b/manifests/ssl.pp
index efa677e..deb464c 100644
--- a/manifests/ssl.pp
+++ b/manifests/ssl.pp
@@ -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
}
}
diff --git a/manifests/vhost/file.pp b/manifests/vhost/file.pp
index 054a530..c3f82c1 100644
--- a/manifests/vhost/file.pp
+++ b/manifests/vhost/file.pp
@@ -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,
+ }
}
+ }
}
diff --git a/templates/default/default_index.erb b/templates/default/default_index.erb
index 844ad04..f5058e7 100644
--- a/templates/default/default_index.erb
+++ b/templates/default/default_index.erb
@@ -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>