Forge Home

netplan

Manages and applies netplan configuration

99,024 downloads

1,571 latest version

5.0 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

  • 2.0.0 (latest)
  • 1.0.1
  • 1.0.0
  • 0.1.10
  • 0.1.9
  • 0.1.8
  • 0.1.7
  • 0.1.6
  • 0.1.5
  • 0.1.4
  • 0.1.3
  • 0.1.2
  • 0.1.1
  • 0.1.0
released Jul 25th 2023
This version is compatible with:
  • Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 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, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >= 4.5.0

Start using this module

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

Add this module to your Puppetfile:

mod 'zehweh-netplan', '2.0.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

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

Manually install this module globally with Puppet module tool:

puppet module install zehweh-netplan --version 2.0.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

zehweh/netplan — version 2.0.0 Jul 25th 2023

puppet-netplan

Table of Contents

  1. Description
  2. Requirements
  3. Usage
  4. Open vSwitch
  5. Miscellaneous

Description

The netplan module manages and applies netplan configuration.

Requirements

  • Puppet >= 4.0
  • puppetlabs/stdlib
  • puppetlabs/concat

Usage

Example with include / Hiera

To use the module with Hiera, you can include the netplan class in your Puppet code:

include netplan

Then, define the netplan configuration in your Hiera YAML file:

netplan::version: 2
netplan::renderer: networkd
netplan::purge_config: true
netplan::ethernets:
    eno1:
      dhcp4: yes
      addresses:
        - 192.168.0.125/16
      nameservers:
        search: [foo.local, bar.local]
        addresses: [8.8.8.8, 4.4.4.4]
      routes:
        - to: 10.10.0.1/16
          via: 10.20.0.1

Example using class

Alternatively, you can use the netplan class directly in your Puppet code:

  class { 'netplan':
    config_file   => '/etc/netplan/01-custom.yaml',
    ethernets     => {
      'ens5' => {
        'dhcp4' => false
      }
    },
    bridges       => {
       'br0' => {
          'dhcp4' => true,
          'interfaces' => [ens5]
       }
    },
    netplan_apply => true,
  }

Open vSwitch

The external_ids and other_config settings in the openvswitch property allow you to pass arbitrary configurations directly to Open vSwitch. To achieve this, you must use the configuration as a string and pay attention to proper indentation.

Example:

Suppose you want to configure Open vSwitch as follows:

    ens13:
      openvswitch:
        external-ids:
          iface-id: mylocaliface
        other-config:
          disable-in-band: false

To pass this configuration as a string in your Hiera file, follow this format:

    ens13:
      openvswitch:
        external_ids: |-1
                   iface-id: mylocaliface
        other_config: |-1
                   disable-in-band: false

Ensure that you maintain the correct indentation while providing the configuration as a string to ensure proper parsing by netplan.

Miscellaneous

For detailed information about each parameter, refer to the Netplan Documentation. The documentation for this module is based on the Netplan official reference.