Forge Home


A collection of network functions and facts


441,769 latest version

4.1 quality score

Version information

  • 0.0.1 (latest)
released Oct 8th 2014

Start using this module

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

Add this module to your Puppetfile:

mod 'yelp-netstdlib', '0.0.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

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

Manually install this module globally with Puppet module tool:

puppet module install yelp-netstdlib --version 0.0.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.



yelp/netstdlib — version 0.0.1 Oct 8th 2014

##Overview Build Status

netstdlib is a collection of puppet functions and facts for network related work.

These functions and facts are very handy when using puppet to do complex logic on code that deals with configuring or interpreting network interfaces.

Most of them simply expose the native ruby implementations into the puppet manifest so you can use them to say, edit OpenStack config files, or manipulate DCHP server pools.


# Use macaddress_rand instead of FQDNs because we have lots of VMs with
# the same hostname
cron::d { 'puppet_agent':
  ensure  => $ensure,
  minute  => macaddress_rand(60),
  user    => 'root',
  command => 'puppet agent -t >/dev/null 2>&1',
# Have the puppet server query DNS to get the current round-robin A records
$web_server_ips_array = gethostbyname2array("")
# Reverse Lookup your ip to a name:
$my_name = gethostbyaddr2array($::ipaddress)
notify { "My reverse dns seems to be: ${my_name}": }



Converts an CIDR address of the form into its broadcast address


Converts an CIDR address of the form into its netmask address


Converts an CIDR address of the form into its network address


Generate MAC addresses based on the results of fqdn_rand. Useful for VMs that might have the same hostname.


Resolve an IP address into one or more names. (Looks up reverse DNS PTRs)


Resolve a name into one or more IP addresses.


Converts an IP in its 32 bit integer representation to a dotted address of the form


Checks if an ip address is contained within a CIDR address of the form


Converts a dotted address of the form into its 32 bit integer representation


Converts a netmask of the form to the mask length (e.g. 16)


Puppet functions are server-side, facts are client side. Keep this in mind as any DNS related functions will take place on the server.