Defined Type: yum::group

Defined in:
manifests/group.pp

Summary

This definition installs or removes yum package group.

Overview

Examples:

Sample usage:

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

Parameters:

  • ensure (Enum['present', 'installed', 'latest', 'absent', 'purged']) (defaults to: 'present')

    specifies if package group should be present (installed) or absent (purged)

  • timeout (Optional[Integer]) (defaults to: undef)

    exec timeout for yum groupinstall command

  • install_options (Array[String[1]]) (defaults to: [])

    options provided to yum groupinstall command



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
# 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', '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,
      }
    }
  }
}