Forge Home


The module contains various functions like validate_platform()


12,320 latest version

4.6 quality score

Version information

  • 0.1.1 (latest)
released Feb 12th 2015
This version is compatible with:
  • ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'gajdaw-diverse_functions', '0.1.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add gajdaw-diverse_functions
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install gajdaw-diverse_functions --version 0.1.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.



gajdaw/diverse_functions — version 0.1.1 Feb 12th 2015

Puppet Module


Table of Contents

  1. Overview
  2. Setup
  3. Usage

1. Overview

The module contains the following functions:


2. Setup

To install the module run:

sudo puppet install module gajdaw-diverse_functions

3. Usage

3.1. validate_platform() function

This function validates if the operating system on the machine that runs manifest matches one of the entires in operatingsystem_support section in metadata.json of the module.

Function needs one parameter: the name of the module to validate.

If the platform returned by the two shell commands:

$ facter operatingsystem
$ facter operatingsystemrelease

can be found in metadata.json then validate_platform() returns true. Otherwise it returns false.

You can use it to automatically validate your module against the current platform. Thus operatingsystem_support section in metadata.json file of your module is the only place where you have to update the information about supported platform.

To validate the platform inside a class defined in a module call the function like in the following snippet:

class abc {

    if !validate_platform($module_name) {
        fail("Platform not supported in module '${module_name}'.")


On some platforms, e.g. CentOS, the command:

$ facter operatingsystemrelease

prints full version, like:


You don't have to use the complete result. You can use arbitrary number of leading characters. The definition:

    "operatingsystem": "CentOS",
    "operatingsystemrelease": [

will be successfully validated on all of the following platforms:

  • CentOS 7.0
  • CentOS 7.0.1406
  • CentOS 7.0.1964-p23
  • CentOS 7.0-dev
  • CentOS 7.0abcdefghijklm


You will find the exact information about supported platforms in metadata.json file.