Permalink
Browse files

kmod: create files & dir are present before writing stuff in them.

  • Loading branch information...
1 parent 2716e10 commit 3a1d4cd7133396d8bf7a1412b9a3dbf812daa131 @mfournier mfournier committed Apr 25, 2012
Showing with 22 additions and 0 deletions.
  1. +4 −0 manifests/generic.pp
  2. +18 −0 manifests/init.pp
@@ -28,6 +28,8 @@
$file
) {
+ include kmod
+
case $ensure {
present: {
if $type == 'install' {
@@ -56,6 +58,7 @@
context => "/files${file}",
changes => $augset,
onlyif => $onlyif,
+ require => File[$file],
}
}
@@ -68,6 +71,7 @@
context => "/files${file}",
changes => "rm ${type}[. = '${module}']",
onlyif => "match ${type}[. = '${module}'] size > 0",
+ require => File[$file],
}
}
View
@@ -0,0 +1,18 @@
+#
+# == Class: kmod
+#
+# Ensures a couple of mandatory files are present before managing their
+# content.
+#
+#
+class kmod {
+
+ file { '/etc/modprobe.d': ensure => directory }
+
+ file { [
+ '/etc/modprobe.d/modprobe.conf',
+ '/etc/modprobe.d/aliases.conf',
+ '/etc/modprobe.d/blacklist.conf',
+ ]: ensure => present,
+ }
+}

0 comments on commit 3a1d4cd

Please sign in to comment.