Forge Home


Set facts based on network ranges


8,810 latest version

4.6 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.1.6 (latest)
  • 0.1.5
  • 0.1.4
  • 0.1.3
  • 0.1.2
  • 0.1.1
  • 0.1.0
released Jul 14th 2017
This version is compatible with:
  • Debian, RedHat, Ubuntu, Windows, Solaris, AIX

Start using this module

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

Add this module to your Puppetfile:

mod 'dylanratcliffe-cidr_facts', '0.1.6'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add dylanratcliffe-cidr_facts
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install dylanratcliffe-cidr_facts --version 0.1.6

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.



dylanratcliffe/cidr_facts — version 0.1.6 Jul 14th 2017

CIDR Facts module

Define facts by network zone.

This module allows you to define attributes of many network zones and combine them into a single fact for each server.

It is very common for custom facts to be determined based on the network zone that a machine is in. However creating a new custom fact for each attribute that can be determined by IP address can be extremely tedious and the logic can become extremely complex, especially if your network is not straightforward. i.e. If 10.36.x.x is production, with the exception of 10.36.12.x, which is UAT

How it works

This module works by reading json files from the lib/facter/cidr.d directory. These files are added to a custom module and are distributed to each node using pluginsync. Each JSON file contains a hash of the following structure:

  "CIDR": {
    "some_fact": "some_value"

The data from all .json files is merged and the facts that apply to a given node are returned. If a node is part of multiple CIDR ranges that define the same fact, the most specific (smallest) range will take precedence. Here is a real life example:

  "": {
    "datacenter": "kyabram"
  "": {
    "zone": "DMZ",
    "owner": "Dylan"
  "": {
    "zone": "SUPER-DMZ",
    "compliance_level": "excruciating"

Given the above data, a node with the IP would have the following facts:

  "datacenter": "kyabram",
  "owner": "Dylan",
  "zone": "SUPER-DMZ",
  "compliance_level": "excruciating"