Forge Home


Utilize Hiera hierachies and default resource parameters for DRY network device configuration.


7,509 latest version

3.8 quality score

Version information

  • 0.3.0 (latest)
  • 0.2.0
released Dec 19th 2015
This version is compatible with:
  • Puppet Enterprise >= 2015.0.0
  • Puppet >= 4.0.0

Start using this module

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

Add this module to your Puppetfile:

mod 'jorhett-device_hiera', '0.3.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add jorhett-device_hiera
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install jorhett-device_hiera --version 0.3.0

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.



jorhett/device_hiera — version 0.3.0 Dec 19th 2015


Table of Contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Setup - The basics of getting started with device_hiera
  4. Usage - Configuration options and additional functionality
  5. Limitations - OS compatibility, etc.
  6. Development - Guide for contributing to the module


TL;DR - DRY network device configuration

Network device configuration (e.g. Cisco, Juniper, Arista, etc) using individual resources is messy and repetitive. This module takes advantage of Hiera hierarchies and hash merging to simplify and centralize network device configuration.

This module can reduce the configuration of a distribution campus switch environment from thousands of lines to a few dozen.

Module Description

Device Hiera makes uses of Hiera data and Hiera hierarchies to provide complete network device configurations with a DRY and minimal data input format. This module does no implementation, it simply utilizes Hiera's hash merging capabilities to creates the appropriate device-specific resources.


No setup required other than

  • define the Hiera data for each type as documented
  • ensure that you've installed modules which provide the device resource you want (e.g. anything other than vlan and interface)

Setup Requirements

Define Hiera data as documented here or in the module examples.


List the resource types you wish to load from Hiera data.

  • interfaces to provide slots and port ranges (notice plural)
  • vlan to manage vlans
  • ...any other type provided by modules you have installed

Declare the base class, and list the resource types which should be used from Hiera.

  - device_hiera

  - vlan
  - interfaces

For each resource type you can define defaults which will be used if not overridden in the specific definition. For example, interface definition:

  description  : 'Default interface configuration'
  mode         : 'dynamic auto'
  encapsulation: 'negotiate'
  access_vlan  : '200'

Interfaces are special because we provide the ability to list slots in the chassis along with a list of ports, which obviously the interface parameter doesn't handle.

First define an array which contains a single key of the slot name, and a value containing a single range of ports MIN-MAX. The slot can defined multiple times.

  - 'FastEthernet0'     : '2-23'
  - 'GigabitEthernet1/0': '1-2'
  - 'GigabitEthernet1/0': '5-6'

Then define the custom parameters for any port with a non-default configuration. These ports can fall inside or outside of the slots and ranges supplied above.

     description  : 'Uplink to core'
     mode         : 'trunking'
     encapsulation: 'dot1q'
     native_vlan  : 200

Any other resource type can also be created with parameters supplied in a hash under their title. They can likewise fall back on default values for the type.

Values for the resource types and parameters should be taken from the module which provides the resource type in question. Documentation for the vlan type used below can be found at

  - vlan

  ensure: present

    description: 'vlan200_Funtime :'
    description: 'vlan400_fail'

For another example, if you have installed the puppetlabs/ciscopuppet module, you could use this for OSPF configuration:

  - cisco_interface_ospf

  ensure: present
  cost  : 200
  ospf  : default

  'Ethernet1/2 default': 
    area: ''

What device_hiera affects

  • Uses Hiera hierarchy and data merging to simplify multiple device configuration
  • Allows definition of port defaults which reduces repetitive data entry (DRY)
  • Can be used with any network device vendor



You will need to include any vendor-specific modules necessary to implement the resources created by device_hiera.


Any and all patches or features welcome and encouraged.