diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2009-11-05 17:45:20 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2009-11-05 17:45:20 -0200 |
commit | 7e07d48d16630d547b86670b4c66164b18f5492b (patch) | |
tree | ca5e7994e8e3ead902d7d2b91f88edf4d6de6fb8 | |
parent | d6ea12f3244c47a6520a89621d2daae4b0c37242 (diff) | |
download | puppet-apache-7e07d48d16630d547b86670b4c66164b18f5492b.tar.gz puppet-apache-7e07d48d16630d547b86670b4c66164b18f5492b.tar.bz2 |
Ensuring mod_macro is enabled
-rw-r--r-- | manifests/init.pp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index 68d7918..8381ed0 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -29,7 +29,6 @@ class apache { ensure => installed, } - # TODO: enable mod_macro package { "mod_macro": name => "libapache2-mod-macro", ensure => installed, @@ -51,6 +50,11 @@ class apache { notify => Service["apache"], } + module { "macro": + ensure => present, + require => "mod_macro", + } + # prepare variables to use in templates case $apache_sites_folder { '': { $apache_sites_folder = '/var/www/sites' } @@ -85,4 +89,33 @@ class apache { notify => Service["apache"], } } + + # Code from http://reductivelabs.com/trac/puppet/wiki/Recipes/DebianApache2Recipe + # Define an apache2 module. Debian packages place the module config + # into /etc/apache2/mods-available. + # + # You can add a custom require (string) if the module depends on + # packages that aren't part of the default apache2 package. Because of + # the package dependencies, apache2 will automagically be included. + define module ( $ensure = 'present', $require = 'apache2' ) { + 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 ]'", + notify => Exec["force-reload-apache2"], + require => Package[$require], + } + } + '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 ]'", + notify => Exec["force-reload-apache2"], + require => Package["apache2"], + } + } + default: { err ( "Unknown ensure value: '$ensure'" ) } + } + } } |