Forge Home

namikoda

Replace magic IPs with human-readable references

6,187 downloads

6,187 latest version

4.1 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.0 (latest)
released Apr 29th 2017

Start using this module

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

Add this module to your Puppetfile:

mod 'namikoda-namikoda', '0.1.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

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

Manually install this module globally with Puppet module tool:

puppet module install namikoda-namikoda --version 0.1.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.

Download

Documentation

namikoda/namikoda — version 0.1.0 Apr 29th 2017

Namikoda

Table of Contents

  1. Description
  2. Compatibility
  3. Getting Started
  4. Usage - Configuration options and additional functionality
  5. More Information
  6. Development

Description

IP range management in the cloud, made easy

Namikoda provides an easy interface for getting configuration values consistent across your physical and cloud infrastructure. We focus on providing IP range data and the tooling to act on it. Confidently use human-readable tags instead of lists of IPs in your configuration.

This module is an interface between puppet and the Namikoda API.

Compatibility

This module was developed against Puppet 4. It's unlikely to work with any prior version.

Getting started with Namikoda

Go get an API key

If you haven't yet, generate an API key at https://manage.namikoda.com. See the registration documentation for the step-by-step process.

Set the key

Once you have an API key, add a line in your sites.pp or equivalent to tell the namikoda library what it is.

namikoda::set_apikey("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")

That will let the library set the right headers in the REST calls.

Usage

Functions

ipv4sfor

The namikoda::ipv4sfor() function takes one parameter, the ID of the site that you're trying to get the IPs for. It returns an array of strings. Each string is a CIDR-encoded IPv4 range.

notice (namikoda::ipv4sfor('github'))
# Logs [ 185.199.108.0/22, 192.30.252.0/22 ]

ipv6sfor

The namikoda::ipv6sfor() function takes one parameter, the ID of the site that you're trying to get the IPs for. It returns an array of strings. Each string is a CIDR-encoded IPv6 range.

notice (namikoda::ipv6sfor('github'))
# Logs [ 2620:112:3000::/44 ]

value

The namikoda::value() function takes one parameter, the ID of the site that you're trying to get the IPs for. It returns an array of strings. Each string is a CIDR-encoded IP range, combining both the IPv4 and IPv6 ranges above.

notice (namikoda::value('github'))
# Logs [ 185.199.108.0/22, 192.30.252.0/22, 2620:112:3000::/44 ]

puppetlabs/firewall integration

This module integrates well with puppetlabs/firewall. Assuming that the firewall module is imported, you can iterate over the ranges returned by one of the functions above and create rules as you see fit.

For example:


each( namikoda::ipv4sfor('github') ) |$subnet| {
  firewall { "006 Allow inbound HTTP from github webhook subnet $subnet":
    dport    => 80,
    proto    => tcp,
    action   => accept,
    source   => $subnet,
  }
}

More information

See https://docs.namikoda.com for more detailed information about Namikoda and what sites are available.

Development

We love PRs! Head over to https://github.com/namikoda/puppet and fork away.