Managing Yum software groups with CFEngine
  2013-04-04

With its group commands (groupinstall, groupremove, …), Yum is able to install a set of packages to quickly set up a system for a specific task.

This blog post is a great introduction to Yum software groups

In CFEngine, it is now possible (feature merged in master, but not yet released) to handle such groups through yum_group package_method.

Some examples:

  • Installing perl-runtime and basic-desktop groups:
body common control {
  bundlesequence => { "foo" };
  inputs  =>  { "/var/cfengine/inputs/libraries/cfengine_stdlib.cf" };
}

bundle agent foo {

  vars:
    "packages"      slist   =>      { "perl-runtime", "basic-desktop" };

  packages:
    "$(packages)"
      package_policy        =>      "add",
      package_method        =>      yum_group;
}
  • Removing debugging group:
body common control {
  bundlesequence => { "foo" };
  inputs  =>  { "/var/cfengine/inputs/libraries/cfengine_stdlib.cf" };
}

bundle agent foo {

  vars:
    "packages"  slist   =>  { "debugging" };

  packages:
    "$(packages)"
      package_policy    =>  "delete",
      package_method    =>  yum_group;
}

You can find here a full example (with runtime output), and here the body of the yum_group package_method

This has only been tested on a CentOS-6.2 system, any feedback is welcome !