Forge Home

network

Manage non-volatile network configuration

432,672 downloads

1,361 latest version

5.0 quality score

Version information

  • 0.10.1 (latest)
  • 0.10.0
  • 0.9.0
  • 0.8.0
  • 0.7.0
  • 0.6.1
  • 0.6.0
  • 0.5.0
released Oct 28th 2021
This version is compatible with:
  • Puppet Enterprise 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x
  • Puppet >= 6.1.0 < 8.0.0
  • , ,

Start using this module

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

Add this module to your Puppetfile:

mod 'puppet-network', '0.10.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

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

Manually install this module globally with Puppet module tool:

puppet module install puppet-network --version 0.10.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

puppet/network — version 0.10.1 Oct 28th 2021

Network module for Puppet

Build Status Code Coverage Puppet Forge Puppet Forge - downloads Puppet Forge - endorsement Puppet Forge - scores

Overview

Manage non-volatile network and route configuration.

Usage

Interface configuration

network_config { 'eth0':
  ensure  => 'present',
  family  => 'inet',
  method  => 'dhcp',
  onboot  => 'true',
  hotplug => 'true',
  options => {'pre-up' => 'sleep 2'},
}

network_config { 'lo':
  ensure => 'present',
  family => 'inet',
  method => 'loopback',
  onboot => 'true',
}

network_config { 'eth1':
  ensure    => 'present',
  family    => 'inet',
  ipaddress => '169.254.0.1',
  method    => 'static',
  netmask   => '255.255.0.0',
  onboot    => 'true',
}

Route configuration

Route resources should be named in CIDR notation. If not, they will not be properly mapped to existing routes and puppet will apply them on every run. Default routes should be named 'default'.

For Debian:

network_route { '172.17.67.0/24':
  ensure    => 'present',
  gateway   => '172.18.6.2',
  interface => 'vlan200',
  netmask   => '255.255.255.0',
  options   => 'table 200',
}

For RedHat Enterprise:

network_route { '172.17.67.0/24':
  ensure    => 'present',
  gateway   => '10.0.2.2',
  interface => 'eth0',
  netmask   => '255.255.255.0',
  network   => '172.17.67.0',
  options   => 'table 200',
}
network_route { 'default':
  ensure    => 'present',
  gateway   => '10.0.2.2',
  interface => 'eth0',
  netmask   => '0.0.0.0',
  network   => 'default'
}

Create resources on the fly with the puppet resource command:

root@debian-6:~# puppet resource network_config eth1 ensure=present family=inet method=static ipaddress=169.254.0.1 netmask=255.255.0.0
notice: /Network_config[eth1]/ensure: created
network_config { 'eth1':
  ensure    => 'present',
  family    => 'inet',
  ipaddress => '169.254.0.1',
  method    => 'static',
  netmask   => '255.255.0.0',
  onboot    => 'true',
}

# puppet resource network_route 23.23.42.0 ensure=present netmask=255.255.255.0 interface=eth0 gateway=192.168.1.1
notice: /Network_route[23.23.42.0]/ensure: created
network_route { '23.23.42.0':
  ensure    => 'present',
  gateway   => '192.168.1.1',
  interface => 'eth0',
  netmask   => '255.255.255.0',
  options   => 'table 200',
}

Dependencies

This module requires the FileMapper mixin, available at https://github.com/voxpupuli/puppet-filemapper. The network_config type requires the Boolean mixin, available at https://github.com/adrienthebo/puppet-boolean.

The debian routes provider requires the package ifupdown-extra. The network_config class requires the ipaddress gem, which needs to be installed on both the puppet master and the nodes. ifupdown-extra and ipaddress can be installed automatically using the network class. To use it, include it like so in your manifests:

include '::network'

This class also provides fine-grained control over which packages to install and how to install them. The documentation for the parameters exposed can be found here.

The ipaddress gem can also be installed manually with:

sudo gem install ipaddress --no-ri --no-rdoc

Note: you may also need to update your master's plugins (run on your puppet master):

puppet agent -t --noop

Or on puppet 3.8.7/4.x:

puppet plugin download

Contact