Puppet 5

It has shipped! Puppet 5 is here and the gem has been available since the 27th June 2017.

Puppetlabs logo

Puppet 5 shipped

What does this mean to us DevOps techies though? The main ‘features’ of puppet 5 are largely around standardising on other product version numbers of the major puppet components. Server, puppetDB and Agent.

As you probably know, I’m a big fan of the Puppet Agent, deployed in a masterless fashion. Focusing on the agent then; Puppet 5.0.0 Facter 3.7.0 Hiera 5.0.0

Puppet 5 has hiera 5 built in which, amongst other things, expects a new configuration file. No rush yet, just deprecation warnings for now.

Ruby 2.4 is now expected and deprecation warnings will show if 2.2 or older is running.

Now these are just the differences from Puppet 4. If you haven’t updated from Puppet 3, the curve is a bit steeper.

Running your code through the linters is usually enough to get Puppet 4 compliant code and the main gotcha is about data types.

In puppet 3 most (if not all) variables are Strings, this leads to many manifests having the strange

if $variable == 'true'

With puppet 4 this will evaluate to false as $variable is no longer converted to a String.

The other main gotcha I’ve seen is within the file directive.

file{'myfile':
  ensure => present,
  mode   => 755
}

Fortunately the linter will pick this up also and tell you that the filemode needs to be enclosed in a string

file{'myfile':
  ensure => present,
  mode   => '0755'
}

Puppet then interprets this correctly.

The real killer is that empty variables in puppet 4 are evaluated as false. This can create havok if your code checks rely on a non-empty string returning true.

In short run a linter against your puppet modules and these should be caught easily. Instructions for using Puppetlabs spec helper.

We are about to run a programme all about Devops, to find out more, follow the Devops link