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
|
# File 'manifests/group.pp', line 13
define yum::group (
Array[String[1]] $install_options = [],
Enum['present', 'installed', 'latest', 'absent', 'purged'] $ensure = 'present',
Optional[Integer] $timeout = undef,
) {
Exec {
path => '/bin:/usr/bin:/sbin:/usr/sbin',
environment => 'LC_ALL=C',
}
case $ensure {
'present', default: { # just install the yum group and ensure the group is present.
exec { "yum-groupinstall-${name}":
command => join(concat(["yum -y group install '${name}'"], $install_options), ' '),
unless => "yum grouplist hidden '${name}' | egrep -i '^Installed.+Groups:$'",
timeout => $timeout,
}
}
'installed': { # install the yum group and re-install if any packages are missing.
exec { "yum-groupinstall-${name}":
command => join(concat(["yum -y group install '${name}'"], $install_options), ' '),
unless => "test $(yum --assumeno group install '${name}' 2>/dev/null| grep -c '^Install.*Package') -eq 0",
timeout => $timeout,
}
}
'latest': { # install the yum group and update if any packages are out of date.
exec { "yum-groupinstall-${name}-latest":
command => join(concat(["yum -y group install '${name}'"], $install_options), ' '),
unless => "test $(yum --assumeno group install '${name}' 2>/dev/null| grep -c -e '^Install.*Package' -e '^Upgrade.*Package') -eq 0",
timeout => $timeout,
}
}
'absent', 'purged': {
exec { "yum-groupremove-${name}":
command => "yum -y group remove '${name}'",
onlyif => "yum grouplist hidden '${name}' | egrep -i '^Installed.+Groups:$'",
timeout => $timeout,
}
}
}
}
|