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
58
59
60
61
62
63
64
65
66
67
|
# File 'manifests/setting.pp', line 19
define kmod::setting (
Stdlib::Unixpath $file,
String[1] $category,
Optional[String] $option = undef,
Optional[Scalar] $value = undef,
String[1] $module = $name,
Enum['present', 'absent'] $ensure = 'present',
) {
include kmod
ensure_resource(
'file',
$file,
{
'ensure' => 'file',
'owner' => $kmod::owner,
'group' => $kmod::group,
'mode' => $kmod::file_mode,
}
)
case $ensure {
'present': {
if $option {
$changes = [
"set ${category}[. = '${module}'] ${module}",
"set ${category}[. = '${module}']/${option} ${value}",
]
} else {
$changes = [
"set ${category}[. = '${module}'] ${module}",
]
}
}
'absent': {
$changes = "rm ${category}[. = '${module}']"
}
default: { fail ( "unknown ensure value ${ensure}" ) }
}
augeas { "kmod::setting ${title} ${module}":
incl => $file,
lens => 'Modprobe.lns',
changes => $changes,
require => File[$file],
}
}
|