8000 GitHub - ltning/puppet-ip_in_range: A small(ish) sample Puppet function to determine if an ip is within a given CIDR
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

A small(ish) sample Puppet function to determine if an ip is within a given CIDR

License

Notifications You must be signed in to change notification settings

ltning/puppet-ip_in_range

 
 

Repository files navigation

puppet-ip_in_range

Build Status Puppet Forge

A Puppet function to determine if an IPv4 address is within the IPv4 CIDR

ip_in_range returns true if the ipaddress is within the given CIDRs

usage: ip_in_range(<IPv4 Address>, <IPv4 CIDR>)

or when you want to check against more than one CIDR and return true if the IP address is contained in any of them.

$ranges = ['192.168.0.0/24', '10.10.10.0/24']
$valid_ip = ip_in_range('10.10.10.53', $ranges) # $valid_ip == true

There are a couple of commonly used patterns -

$valid_ip = ip_in_range('10.10.10.53', '10.10.10.0/24') # $valid_ip == true

or using the check as part of a conditional -

if ip_in_range($ipaddress, '10.10.200.0/24') == true {
  notify { 'Do subnet based resources here': }
}

It has a dependency on puppetlabs-stdlib to work.

Installation

You can install this module from PuppetForge:

puppet module install deanwilson-ip_in_range

License

Apache 2.0 - Dean Wilson

About

A small(ish) sample Puppet function to determine if an ip is within a given CIDR

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%
0