diff options
author | Jerome Charaoui <jcharaoui@cmaisonneuve.qc.ca> | 2009-12-08 15:20:55 -0500 |
---|---|---|
committer | Jerome Charaoui <jcharaoui@cmaisonneuve.qc.ca> | 2009-12-08 15:20:55 -0500 |
commit | e4db5feeba6fed42478fa8929f18781443d971d8 (patch) | |
tree | 809f1214282fcfa49b82c61c8be49c766813c28f | |
parent | f3be4617f18ae0c31d26efc47ad5e5f11887052e (diff) |
manage debian apache module packages
-rw-r--r-- | manifests/debian/module.pp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/manifests/debian/module.pp b/manifests/debian/module.pp index 31eb508..19ac7b6 100644 --- a/manifests/debian/module.pp +++ b/manifests/debian/module.pp @@ -1,19 +1,31 @@ define apache::debian::module( - $ensure = present + $ensure = present, + $package_name = 'absent' ){ $modules_dir = "$apache::debian::config_dir/mods" + if ($package_name != 'absent') { + package { "${package_name}": + ensure => $ensure, + notify => Service['apache'], + require => Package['apache'], + } + } + case $ensure { 'present' : { - exec { "/usr/sbin/a2enmod $name": + exec { "/usr/sbin/a2enmod ${name}": unless => "/bin/sh -c '[ -L ${modules_dir}-enabled/${name}.load ] \\ && [ ${modules_dir}-enabled/${name}.load -ef ${modules_dir}-available/${name}.load ]'", notify => Service['apache'], - require => Package['apache'], + require => $package_name ? { + 'absent' => Package['apache'], + default => Package[['apache',$package_name]], + }, } } 'absent': { - exec { "/usr/sbin/a2dismod $name": + exec { "/usr/sbin/a2dismod ${name}": onlyif => "/bin/sh -c '[ -L ${modules_dir}-enabled/${name}.load ] \\ && [ ${modules_dir}-enabled/${name}.load -ef ${modules_dir}-available/${name}.load ]'", notify => Service['apache'], |