summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
Diffstat (limited to 'manifests')
-rw-r--r--manifests/init.pp65
-rw-r--r--manifests/module.pp8
-rw-r--r--manifests/passenger.pp2
-rw-r--r--manifests/site.pp22
4 files changed, 40 insertions, 57 deletions
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",
},
diff --git a/manifests/module.pp b/manifests/module.pp
index 8a36432..64a692c 100644
--- a/manifests/module.pp
+++ b/manifests/module.pp
@@ -8,15 +8,15 @@ define apache::module($ensure = 'present') {
case $ensure {
'present': {
exec { "/usr/sbin/a2enmod $name":
- unless => "/bin/sh -c '[ -L ${apache2_mods}-enabled/${name}.load ] \
- && [ ${apache2_mods}-enabled/${name}.load -ef ${apache2_mods}-available/${name}.load ]'",
+ unless => "/bin/sh -c '[ -L ${apache::mods}-enabled/${name}.load ] \
+ && [ ${apache::mods}-enabled/${name}.load -ef ${apache::mods}-available/${name}.load ]'",
notify => Exec["force-reload-apache2"],
}
}
'absent': {
exec { "/usr/sbin/a2dismod $name":
- onlyif => "/bin/sh -c '[ -L ${apache2_mods}-enabled/${name}.load ] \
- && [ ${apache2_mods}-enabled/${name}.load -ef ${apache2_mods}-available/${name}.load ]'",
+ onlyif => "/bin/sh -c '[ -L ${apache::mods}-enabled/${name}.load ] \
+ && [ ${apache::mods}-enabled/${name}.load -ef ${apache::mods}-available/${name}.load ]'",
notify => Exec["force-reload-apache2"],
}
}
diff --git a/manifests/passenger.pp b/manifests/passenger.pp
index 92230f0..1ebcb14 100644
--- a/manifests/passenger.pp
+++ b/manifests/passenger.pp
@@ -1,4 +1,4 @@
-class apache::passenger inherits apache {
+class apache::passenger {
package { "mod_rack":
name => "libapache2-mod-passenger",
ensure => installed,
diff --git a/manifests/site.pp b/manifests/site.pp
index 0c68361..d5046da 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -109,25 +109,25 @@ define apache::site($ensure = present, $docroot = false, $redirect = false,
case $source {
true: {
- file { "${apache2_sites}-available/$vhost":
+ file { "${apache::sites}-available/$vhost":
ensure => $ensure,
source => [ "puppet:///modules/site-apache/vhosts/$domain/$title",
"puppet:///modules/site-apache/vhosts/$title" ],
owner => root,
group => root,
mode => 0644,
- require => File["${apache2_macros}"],
+ require => File["${apache::macros}"],
notify => Service["apache"],
}
}
false: {
- file { "${apache2_sites}-available/$vhost":
+ file { "${apache::sites}-available/$vhost":
ensure => $ensure,
content => template("$template"),
owner => root,
group => root,
mode => 0644,
- require => File["${apache2_macros}"],
+ require => File["${apache::macros}"],
notify => Service["apache"],
}
}
@@ -136,7 +136,7 @@ define apache::site($ensure = present, $docroot = false, $redirect = false,
# Enable the site without a2ensite
#
#$status = $ensure ? {
- # 'present' => "${apache2_sites}-available/$vhost",
+ # 'present' => "${apache::sites}-available/$vhost",
# default => 'absent',
#}
#
@@ -144,7 +144,7 @@ define apache::site($ensure = present, $docroot = false, $redirect = false,
# ensure => $status,
# owner => root,
# group => root,
- # require => File["${apache2_sites}-available/$title"],
+ # require => File["${apache::sites}-available/$title"],
# notify => Service["apache"],
#}
@@ -171,19 +171,19 @@ define apache::site($ensure = present, $docroot = false, $redirect = false,
}
}
exec { "/usr/sbin/a2ensite $vhost":
- unless => "/bin/sh -c '[ -L ${apache2_sites}-enabled/$vhost ] \
- && [ ${apache2_sites}-enabled/$vhost -ef ${apache2_sites}-available/$vhost ]'",
+ unless => "/bin/sh -c '[ -L ${apache::sites}-enabled/$vhost ] \
+ && [ ${apache::sites}-enabled/$vhost -ef ${apache::sites}-available/$vhost ]'",
notify => Exec["reload-apache2"],
}
}
'absent': {
exec { "/usr/sbin/a2dissite $vhost":
- onlyif => "/bin/sh -c '[ -L ${apache2_sites}-enabled/$vhost ] \
- && [ ${apache2_sites}-enabled/$vhost -ef ${apache2_sites}-available/$vhost ]'",
+ onlyif => "/bin/sh -c '[ -L ${apache::sites}-enabled/$vhost ] \
+ && [ ${apache::sites}-enabled/$vhost -ef ${apache::sites}-available/$vhost ]'",
notify => Exec["reload-apache2"],
}
- file { "${apache2_sites}-enabled/$vhost":
+ file { "${apache::sites}-enabled/$vhost":
ensure => absent,
notify => Exec["reload-apache2"],
}