Defined Type: kmod::load
- Defined in:
-
manifests/load.pp
Summary
Manage a kernel module in /etc/modules.
Overview
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'manifests/load.pp', line 7
define kmod::load (
Enum['present', 'absent'] $ensure = 'present',
) {
include kmod
case $ensure {
'present': {
case $facts['os']['family'] {
'Debian': {
$changes = "clear '${name}'"
}
'Suse': {
$changes = "set MODULES_LOADED_ON_BOOT/value[.='${name}'] '${name}'"
}
default: {}
}
exec { "modprobe ${name}":
path => '/bin:/sbin:/usr/bin:/usr/sbin',
unless => "grep -qE '^${name} ' /proc/modules",
}
}
'absent': {
case $facts['os']['family'] {
'Debian': {
$changes = "rm '${name}'"
}
'Suse': {
$changes = "rm MODULES_LOADED_ON_BOOT/value[.='${name}']"
}
default: {}
}
exec { "modprobe -r ${name}":
path => '/bin:/sbin:/usr/bin:/usr/sbin',
onlyif => "grep -qE '^${name} ' /proc/modules",
}
}
default: { fail "${module_name}: unknown ensure value ${ensure}" }
}
file { "/etc/modules-load.d/${name}.conf":
ensure => $ensure,
mode => $kmod::file_mode,
owner => $kmod::owner,
group => $kmod::group,
content => "# This file is managed by the puppet kmod module.\n${name}\n",
}
}
|