From: Peter Palfrader Date: Sat, 19 Mar 2011 15:07:30 +0000 (+0100) Subject: Try adding a linux_module function X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=16b2e346382dc3b685adddeb4e8809c92b37686e;p=mirror%2Fdsa-puppet.git Try adding a linux_module function --- diff --git a/modules/debian-org/manifests/init.pp b/modules/debian-org/manifests/init.pp index 1e23846d0..75bb70de3 100644 --- a/modules/debian-org/manifests/init.pp +++ b/modules/debian-org/manifests/init.pp @@ -17,6 +17,26 @@ define set_alternatives($linkto) { } } +define linux_module ($ensure) { + case $ensure { + present: { + exec { "append_module_${name}": + command => "echo '${name}' >> /etc/modules", + unless => "grep -q -F -x '${name}' /etc/modules", + } + } + absent: { + exec { "remove_module_${name}": + command => "sed -i -e'/^${name}\$/d' /etc/modules", + onlyif => "grep -q -F -x '${name}' /etc/modules", + } + } + default: { + err("invalid ensure value ${ensure}") + } + } +} + class debian-org { package {