From e4db5feeba6fed42478fa8929f18781443d971d8 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Tue, 8 Dec 2009 15:20:55 -0500 Subject: manage debian apache module packages --- manifests/debian/module.pp | 20 ++++++++++++++++---- 1 file 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'], -- cgit v1.2.3