Custom Fact to report number of outstanding yum updates, ad hoc Tasks for cleaning and updating, code to automatically update.

Gabe Schuyler



1,656 latest version

4.9 quality score

Version information

  • 1.5.0 (latest)
  • 1.4.1
  • 1.4.0
  • 1.3.0
  • 1.2.2
  • 1.2.1
  • 1.2.0
  • 1.1.0
  • 1.0.2
  • 1.0.1
  • 1.0.0
released Oct 25th 2019
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >= 4.0.0 < 7.0.0
  • RedHat
  • clean_all
  • update

Start using this module


gabe/yum_updates — version 1.5.0 Oct 25th 2019



This module implements a single structured fact that reports on whether a system has outstanding yum updates, and the number of updates that are outstanding.

For instance, a system with eighty-two outstanding updates will report the following:

  count => 82,
  available => true


Is an integer reflecting how many updates are outstanding. If none are outstanding, it returns zero.


Is a boolean reflecting whether count indicates that one or more updates is outstanding.


This module includes two tasks, for ad-hoc use with Puppet Bolt.


Running this tasks executes a yum clean all command on the target nodes. It does not accept any parameters, and does not support noop mode.


Running this tasks executes a yum -y update command on the target nodes. It does not accept any parameters, and does not support noop mode.


This module implements a single, very simple class, yum_upates, which you can use to periodically run yum -y update on some machines. This class defaults to not actually doing anything; you will need to set its "autoupdate" parameter to true, if you actually want it to run the yum command.

For instance, declare it like this, to have it run updates once per weekday.

class { 'yum_updates':
  autoupdate => true,

Alternately, you might use Hiera to decide what nodes apply updates and which ones don't. Since the class defaults to doing, nothing, you simply need to add a single key to machines that do need to apply updates. For instance, with the following yaml:

yum_updates::autoupdate: true

There's a class parameter if you want to tack anything on to the end of the yum command. The string is just tacked on, verbatim, to the command. For instance, to leave out a repo from the update run:

class { 'yum_updates':
  autoupdate => true,
  append_to_command => '--disablerepo=epel',

Inventory Script

This module includes a sample MCollective inventory script, which can be used to list all running hosts, and their current count of yum updates outstanding. Use the mco inventory command's --script argument, to use the script. For instance on Puppet Enterprise, with the script in /tmp:

sudo -u peadmin -i mco inventory -F osfamily=RedHat --script /tmp/updates.mc

The script will need to be readable by the user running MCollective. For instance, if you are running Puppet Enterprise, the "peadmin" user will need to be able to read the script.