Forge Home

ip

Provide some data type aliases for IP addresses

138,939 downloads

99,859 latest version

4.5 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.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 1.0.1 (latest)
  • 1.0.0
released Jan 8th 2018
This version is compatible with:
  • Puppet Enterprise 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >= 4.4.0 < 6.0.0

Start using this module

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

Add this module to your Puppetfile:

mod 'thrnio-ip', '1.0.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

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

Manually install this module globally with Puppet module tool:

puppet module install thrnio-ip --version 1.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.

Download

Documentation

thrnio/ip — version 1.0.1 Jan 8th 2018

Table of Contents

  1. Overview
  2. Usage - Most commonly used data type aliases
  3. Reference - Full listing of data type aliases

Overview

This module provides some data types aliases (introduced in Puppet 4.4) for working with IP addresses.

Usage

This module provides some data types aliases which can be used to simplify type checking in your Puppet 4.4+ compatible code. The most common aliases are likely to be IP::Address, IP::Address::V4, and IP::Address::V6.

IP::Address

The IP::Address alias will match any IP address, including both IPv4 and IPv6 addresses. It will match them either with or without an address prefix as used in CIDR format IPv4 addresses.

Examples

'127.0.0.1' =~ IP::Address                                # true
'8.8.4.4' =~ IP::Address                                  # true
'10.1.240.4/24' =~ IP::Address                            # true
'52.10.10.141' =~ IP::Address                             # true
'192.168.1' =~ IP::Address                                # false
'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ IP::Address  # true
'FF01:0:0:0:0:0:0:101' =~ IP::Address                     # true
'FF01::101' =~ IP::Address                                # true
'FF01:0:0:0:0:0:0:101/32' =~ IP::Address                  # true
'FF01::101/60' =~ IP::Address                             # true
'::' =~ IP::Address                                       # true
'12AB::CD30:192.168.0.1' =~ IP::Address                   # true

IP::Address::V4

The IP::Address::V4 alias will match any string consisting of an IPv4 address in the quad-dotted decimal format, with or without a CIDR prefix. It will not match any abbreviated form (e.g., 192.168.1) because these are poorly documented and inconsistently supported.

Examples

'127.0.0.1' =~ IP::Address::V4                                # true
'8.8.4.4' =~ IP::Address::V4                                  # true
'10.1.240.4/24' =~ IP::Address::V4                            # true
'52.10.10.141' =~ IP::Address::V4                             # true
'192.168.1' =~ IP::Address::V4                                # false
'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ IP::Address::V4  # false
'12AB::CD30:192.168.0.1' =~ IP::Address::V4                   # false

IP::Address::V6

The IP::Address::V6 alias will match any string consistenting of an IPv6 address in any of the documented formats in RFC 2373, with or without an address prefix.

Examples

'127.0.0.1' =~ IP::Address::V6                                # false
'10.1.240.4/24' =~ IP::Address::V6                            # true
'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ IP::Address::V6  # true
'FF01:0:0:0:0:0:0:101' =~ IP::Address::V6                     # true
'FF01::101' =~ IP::Address::V6                                # true
'FF01:0:0:0:0:0:0:101/32' =~ IP::Address::V6                  # true
'FF01::101/60' =~ IP::Address::V6                             # true
'::' =~ IP::Address::V6                                       # true
'12AB::CD30:192.168.0.1' =~ IP::Address::V6                   # true

Reference

IP::Address

The IP::Address alias will match any IP address, including both IPv4 and IPv6 addresses. It will match them either with or without an address prefix as used in CIDR format IPv4 addresses.

IP::Address::V4

The IP::Address::V4 alias will match any string consisting of an IPv4 address in the quad-dotted decimal format, with or without a CIDR prefix. It will not match any abbreviated form (e.g., 192.168.1) because these are poorly documented and inconsistently supported.

IP::Address::V6

The IP::Address::V6 alias will match any string consistenting of an IPv6 address in any of the documented formats in RFC 2373, with or without an address prefix.

IP::Address::NoSubnet

The IP::Address::NoSubnet alias will match the same things as the IP::Address alias, except it will not match an address that includes an address prefix (e.g., it will match 192.168.0.6 but not 192.168.0.6/24).

IP::Address::V4::CIDR

The IP::Address::V4::CIDR alias will match an IPv4 address in the CIDR format. It will only match if the address contains an address prefix (e.g., it will match 192.168.0.6/24 but not 192.168.0.6).

IP::Address::V4::NoSubnet

The IP::Address::V4::NoSubnet alias will match an IPv4 address only if the address does not contain an address prefix (e.g., it will match 192.168.0.6 but not 192.168.0.6/24).

IP::Address::V6::Full

The IP::Address::V6::Full alias will match an IPv6 address formatted in the "preferred form" as documented in section 2.2.1 of RFC 2373, with or without an address prefix as documented in section 2.3 of RFC 2373.

IP::Address::V6::Compressed

The IP::Address::V6::Compressed alias will match an IPv6 address which may contain :: used to compress zeros as documented in section 2.2.2 of RFC 2373. It will match addresses with or without an address prefix as documented in section 2.3 of RFC 2373.

IP::Address::V6::Alternative

The IP::Address::V6::Alternative alias will match an IPv6 address formatted in the "alternative form" allowing for representing the last two 16-bit pieces of the address with a quad-dotted decimal, as documented in section 2.2.1 of RFC 2373. It will match addresses with or without an address prefix as documented in section 2.3 of RFC 2373.

IP::Address::V6::NoSubnet::Full

The IP::Address::V6::NoSubnet::Full alias will match an IPv6 address formatted in the "preferred form" as documented in section 2.2.1 of RFC 2373. It will not match addresses with address prefix as documented in section 2.3 of RFC 2373.

IP::Address::V6::NoSubnet::Compressed

The IP::Address::V6::NoSubnet::Compressed alias will match an IPv6 address which may contain :: used to compress zeros as documented in section 2.2.2 of RFC 2373. It will only match addresses without an address prefix as documented in section 2.3 of RFC 2373.

IP::Address::V6::Alternative

The IP::Address::V6::Alternative alias will match an IPv6 address formatted in the "alternative form" allowing for representing the last two 16-bit pieces of the address with a quad-dotted decimal, as documented in section 2.2.1 of RFC 2373. It will only match addresses without an address prefix as documented in section 2.3 of RFC 2373.