From 2c16c4788cc352a79c548fd9164d65264ae55d22 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 19 Jan 2013 16:04:58 -0200 Subject: Upgrading for 2.7 compatibility --- manifests/init.pp | 65 ++++++++++++++++++++----------------------------------- 1 file changed, 24 insertions(+), 41 deletions(-) (limited to 'manifests/init.pp') diff --git a/manifests/init.pp b/manifests/init.pp index d6428c0..42db664 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -24,40 +24,23 @@ # http://reductivelabs.com/trac/puppet/wiki/Recipes/DebianApache2Recipe # -$apache2_sites = "/etc/apache2/sites" -$apache2_mods = "/etc/apache2/mods" -$apache2_conf_d = "/etc/apache2/conf.d" -$apache2_macros = "/etc/apache2/conf.d/macros" -$apache2_conf = "/etc/apache2/apache2.conf" +class apache( + $sites = "/etc/apache2/sites" + $mods = "/etc/apache2/mods" + $conf_d = "/etc/apache2/conf.d" + $macros = "/etc/apache2/conf.d/macros" + $conf = "/etc/apache2/apache2.conf" + $www_folder = "/var/www/data" + $error_folder = "/var/www/error" + $sites_folder = "/var/sites" + $error_dest = "http://${domain}/missing.html" + $default_folder = '/var/www/data' + $server_name = $hostname + $https_proxy = 'no' +) { -class apache { include ssl - case $apache_www_folder { - '': { $apache_www_folder = "/var/www" } - } - - case $apache_default_folder { - # Give the "It works!" webpage by default. - '': { $apache_default_folder = "/var/www" } - } - - case $apache_sites_folder { - '': { $apache_sites_folder = "${apache_www_folder}/sites" } - } - - case $apache_error_folder { - '': { $apache_error_folder = "${apache_www_folder}/error" } - } - - case $apache_error_dest { - '': { $apache_error_dest = "${apache_error_folder}/index.html" } - } - - case $apache_server_name { - '': { $apache_server_name = $hostname } - } - package { "apache": name => "apache2-mpm-itk", ensure => installed, @@ -97,7 +80,7 @@ class apache { } # apache mod_macro configuration - file { "${apache2_macros}": + file { "${macros}": ensure => present, content => template('apache/macros.erb'), owner => root, @@ -108,7 +91,7 @@ class apache { } # apache mod_macro configuration - file { "${apache2_conf}": + file { "${conf}": ensure => present, content => template('apache/apache2.conf.erb'), owner => root, @@ -118,7 +101,7 @@ class apache { } # apache alias configuration - file { "${apache2_mods}-available/alias.conf": + file { "${mods}-available/alias.conf": ensure => present, content => template('apache/alias.conf.erb'), owner => root, @@ -128,7 +111,7 @@ class apache { } # apache autoindex configuration - file { "${apache2_mods}-available/autoindex.conf": + file { "${mods}-available/autoindex.conf": ensure => present, content => template('apache/autoindex.conf.erb'), owner => root, @@ -141,7 +124,7 @@ class apache { # http://larsjung.de/h5ai/ # http://recursive-design.com/blog/2008/12/29/styling-apache-directory-listings-with-mod_autoindex/ # http://code.ecchi.ca/apache-tango-icons/README.html - file { "${apache_www_folder}/icons": + file { "${www_folder}/icons": ensure => directory, recurse => true, purge => true, @@ -151,12 +134,12 @@ class apache { # This mode will also apply to files from the source directory mode => 0644, # Puppet will automatically set +x for directories - source => [ "puppet:///modules/site-apache/htdocs/$domain/icons", + source => [ "puppet:///modules/site_apache/htdocs/$domain/icons", "puppet:///modules/apache/icons", ] } # default site configuration - file { "${apache2_sites}-available/default": + file { "${sites}-available/default": ensure => present, content => template('apache/default.erb'), owner => root, @@ -167,12 +150,12 @@ class apache { # https proxy configuration # see http://www.metaltoad.com/blog/running-drupal-secure-pages-behind-proxy - file { "$apache2_conf_d/https-proxy": - ensure => $apache_https_proxy ? { + file { "$conf_d/https-proxy": + ensure => $https_proxy ? { '' => absent, default => present, }, - content => $apache_https_proxy ? { + content => $https_proxy ? { 'force' => "SetEnv HTTPS on\n", default => "SetEnvIf X-Forwarded-Proto https HTTPS=on\n", }, -- cgit v1.2.3