28
|
1 |
# Define: yum::config |
|
2 |
# |
|
3 |
# This definition manages yum.conf |
|
4 |
# |
|
5 |
# Parameters: |
|
6 |
# [*key*] - alternative conf. key (defaults to name) |
|
7 |
# [*ensure*] - specifies value or absent keyword |
|
8 |
# [*section*] - config section (default to main) |
|
9 |
# |
|
10 |
# Actions: |
|
11 |
# |
|
12 |
# Requires: |
|
13 |
# RPM based system |
|
14 |
# |
|
15 |
# Sample usage: |
|
16 |
# yum::config { 'installonly_limit': |
|
17 |
# ensure => 2, |
|
18 |
# } |
|
19 |
# |
|
20 |
# yum::config { 'debuglevel': |
|
21 |
# ensure => absent, |
|
22 |
# } |
|
23 |
# |
|
24 |
define yum::config ( |
|
25 |
$ensure, |
|
26 |
$key = $title, |
|
27 |
$section = 'main' |
|
28 |
) { |
|
29 |
validate_string($key, $section) |
|
30 |
|
|
31 |
unless is_integer($ensure) { |
|
32 |
validate_string($ensure) |
|
33 |
} |
|
34 |
|
|
35 |
$_changes = $ensure ? { |
|
36 |
absent => "rm ${key}", |
|
37 |
default => "set ${key} ${ensure}", |
|
38 |
} |
|
39 |
|
|
40 |
augeas { "yum.conf_${section}_${key}": |
|
41 |
incl => '/etc/yum.conf', |
|
42 |
lens => 'Yum.lns', |
|
43 |
context => "/files/etc/yum.conf/${section}/", |
|
44 |
changes => $_changes, |
|
45 |
} |
|
46 |
} |