From 09b77138a3cf505e82f1d5a8d20f794fe1db8434 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 5 Jun 2012 20:07:08 -0300 Subject: new style for 2.7 --- manifests/base.pp | 8 +++--- manifests/config/file.pp | 20 +++++++------- manifests/init.pp | 10 ++++--- manifests/ssl.pp | 2 +- manifests/vhost/file.pp | 53 +++++++++++++++++-------------------- templates/default/default_index.erb | 4 +-- 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 @@ - <%= hostname %> + <%= scope.lookupvar('::hostname') %> @@ -12,7 +12,7 @@ alt="Valid XHTML 1.0 Strict" height="31" width="88" style="border: 0;" />

- <%= hostname %> + <%= scope.lookupvar('::hostname') %>

-- cgit v1.2.3