Using the new Hiera 5 module level data

For quite some time when module writing, we've been using the params.pp pattern. One class in the module, by convention called <MODULENAME>::params, sets the variables for any of the other classes:

class zope::params {  $autoupdate = false,  $default_service_name = 'ntpd',  case $facts['os']['family'] {    'AIX': {      $service_name = 'xntpd'    }    'Debian': {      $service_name = 'ntp'    }    'RedHat': {      $service_name = $default_service_name    }  }}

So, you can see here that we are using some conditional logic depending on the os::family fact, so that the service_name variable can be set appropriately. We are also exposing the autoupdate variable, and giving it a default value.

This params.pp pattern is an elegant little hack, ...

Get Mastering Puppet 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.