Puppet install Yum package groups

Unfortunately Puppet is not able to handle the installation of Yum package groups like “Base” or “compat-libraries” and so forth. This is due to the fact that Puppet is currently not able to verify if all packages in a package group are installed after a Puppet run. To deal with package groups we need a small trick to install all packages within a package group with Puppet.

First let`s find out which packages for example are present in the Yum package group “compat-libraries”

yum group info 'compat-libraries'

Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager

Group: Compatibility Libraries
 Group-Id: compat-libraries
 Description: Compatibility libraries for applications built on previous versions of Red Hat Enterprise Linux.
 Mandatory Packages:

Now let`s make some bash mystics to make the named packages useful for Puppet:

yum group info 'compat-libraries' | grep -i "+" | sed "s/+//g" | tr -d " " | sed "s/^/'/" | sed "s/$/',/"| awk 'ORS=NR?FS:RS'

The output is this:

'compat-db47', 'compat-glibc', 'compat-libf2c-34', 'compat-libgfortran-41', 'compat-libtiff3', 'compat-openldap', 'libpng12', 'openssl098e'

Now we can prepare our Puppet class to install this package group:

class packages {
	# Install package group "compat-libraries"
	$pkggrp_compat_libraries = [ 'compat-db47', 'compat-glibc', 'compat-libf2c-34', 'compat-libgfortran-41', 'compat-libtiff3', 'compat-openldap', 'libpng12', 'openssl098e' ]
        package { $pkggrp_compat_libraries:
		ensure => installed,
		allow_virtual => false,

   One Comment

  1. J. Bren

    This is an interesting solution, but how would you address groups which contain other groups by default. Specifically we are setting up a deployment for Scientific Linux 7 which is a RHEL derivative.

    For example, the “General Purpose System” yumgroup contains base, core, fonts, gnome-desktop, etc.

    Thanks much, we will definitely be going this route for the more specific groups which only install packages – but may end up installing more general yumgroups via kickstart (which I prefer in some cases) or a puppet exec command (which most people want to avoid as much as possible)