Defined Type: yum::group

Defined in:
manifests/group.pp

Overview

Define: yum::group

This definition installs or removes yum package group.

Parameters:

[*ensure*]   - specifies if package group should be
               present (installed) or absent (purged)
[*timeout*]  - exec timeout for yum groupinstall command
[*install_options*]  - options provided to yum groupinstall command

Actions:

Requires:

RPM based system

Sample usage:

yum::group { 'X Window System':
  ensure  => 'present',
}

Parameters:

  • install_options (Array[String[1]]) (defaults to: [])
  • ensure (Enum['present', 'installed', 'latest', 'absent', 'purged']) (defaults to: 'present')
  • timeout (Optional[Integer]) (defaults to: undef)


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
# File 'manifests/group.pp', line 21

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', 'installed', default: {
      exec { "yum-groupinstall-${name}":
        command => join(concat(["yum -y groupinstall '${name}'"], $install_options), ' '),
        unless  => "yum grouplist hidden '${name}' | egrep -i '^Installed.+Groups:$'",
        timeout => $timeout,
      }
      if $ensure == 'latest' {
        exec { "yum-groupinstall-${name}-latest":
          command => join(concat(["yum -y groupinstall '${name}'"], $install_options), ' '),
          onlyif  => "yum groupinfo '${name}' | egrep '\\s+\\+'",
          timeout => $timeout,
          require => Exec["yum-groupinstall-${name}"],
        }
      }
    }

    'absent', 'purged': {
      exec { "yum-groupremove-${name}":
        command => "yum -y groupremove '${name}'",
        onlyif  => "yum grouplist hidden '${name}' | egrep -i '^Installed.+Groups:$'",
        timeout => $timeout,
      }
    }
  }
}