Puppet & Oracle Linux – Fixing those failing manifests!

OS : Oracle Enterprise Linux 6.3 / 6.4

: Oracle Enterprise Linux 6.3 / 6.4 Puppet : Puppet 3.1.1

: Puppet 3.1.1 Facter 1.6 or Higher

Puppet runs great on OEL 6, there really isn’t any pain to implementing it until you get to installing some modules – a lot of them simply don’t know what OEL or OracleLinux is. The fix however, is pretty straightforward and easy if you run current versions of facter and puppet.

First thing you want to do, is validate that you have a current version of facter that has osfamily fact.

[bmiller@puppet ~]$ facter | grep osfamily osfamily => RedHat [bmiller@puppet ~]$

If you have the osfamily support, you will want to edit the manifest that is failing. We will use The Foreman for an example. The Foreman 1.1 has multiple setup files that implement the following code: (you will often find these in install.pp manifests or if you run “puppet agent -t -noop” it should show the failing manifest during a puppet run)

class apache::install { case $::operatingsystem { redhat,centos,fedora,Scientific: { $http_package = 'httpd' } Debian,Ubuntu: { $http_package = 'apache2' } default: { fail("${::hostname}: This module does not support operatingsystem ${::operatingsystem}") } } package { $http_package: ensure => installed, alias => 'httpd' } }

This code fails miserably that “OracleLinux isn’t a supported Operating System. The fix? Instead of looking for each and every type of RedHat Distro and adding more OS Variants to check for (some have a LONG list), use facter to get the $osfamily. It is as simple as this code snippet:

class apache::install { case $::osfamily { RedHat: { $http_package = 'httpd' } Debian: { $http_package = 'apache2' } default: { fail("${::hostname}: This module does not support operatingsystem ${::osfamily}") } } package { $http_package: ensure => installed, alias => 'httpd' } }

I’ve submitted the fixes to the foreman, so future versions can install without a hitch and I hope other developers start implementing the “osfamily” check in lieu of “operatingsystem” checks. The osfamily check makes cleaner code and happier admins 🙂

Hope this helps other people running into issues on OEL / Oracle Linux / OracleLinux (Or whatever they want to call it!)