Version information
This version is compatible with:
- Puppet Enterprise 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
- Puppet >= 6.21.0 < 8.0.0
- , , , , ,
Start using this module
Add this module to your Puppetfile:
mod 'itmage-netplan', '0.1.3'
Learn more about managing modules with a PuppetfileDocumentation
netplan
Table of Contents
- Description
- Setup - The basics of getting started with netplan
- Usage - Configuration options and additional functionality
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
Description
The module is under development.
A Puppet module that installs and configures Netplan.
Setup
Setup Requirements
The following dependencies are required to use the module:
- concat >= '7.4.0'
Beginning with netplan
To start using the module, you need to add it to the manifest. Then, create resources with a description of the interfaces and routes. For example:
include netplan
netplan::interface { 'ens3': addresses => ['192.168.0.1/24'] }
netplan::route { 'Added new route for Office net': dev => 'ens3', to => '172.10.0.1/16', via => '192.168.0.1' }
Usage
The module can create interfaces for bonds and for VLANs. Here are examples of different configurations.
If you need to reset all the addresses from the interface before applying the new configuration
netplan::interface { 'ens3':
flush => true,
addresses => ['10.10.0.10/32']
}
Any additional parameters can be added through the $opts key
netplan::interface { 'ens3':
opts => {'mtu' => 1500},
addresses => ['10.10.0.10/32']
}
Example of Bond interface configuration
netplan::interface { 'bond0':
type => 'bonds',
opts => {
'interfaces' => ['ens3', 'ens4'],
'parameters' => {
'mode' => '802.3ad',
'lacp-rate' => 'fast'
}
},
addresses => ['10.10.0.10/32']
}
Similarly, you can build a VLAN interface
netplan::interface { 'vlan20':
type => 'vlan',
opts => {
'link' => 'bond0',
'id' => 20
},
addresses => ['10.10.0.10/32']
}
Limitations
- There are no tests to check the module works
Development
- I need help adding snippets for working with different tunnels, such as Wireguard. TODO: Initialize basic wireguard support
Reference
Table of Contents
Classes
netplan
: Install Netplannetplan::install
: Install Netplan package
Defined types
netplan::interface
: Create interface $devnetplan::route
: Create route for $dev interface
Functions
core_netplan::get::type
: See https://puppet.com/docs/puppet/latest/lang_write_functions_in_puppet.html for more information on native puppet functions.
Classes
netplan
Install Netplan
Examples
include netplan
Parameters
The following parameters are available in the netplan
class:
package_name
Data type: String
Default value: 'netplan'
package_ensure
Data type: String
Default value: 'present'
config_file
Data type: String
Default value: '/etc/netplan/netplan.yaml'
replace
Data type: Boolean
Default value: true
config_version
Data type: Integer
Default value: 2
config_hash
Data type: Hash
Default value:
{
'network' => {
'version' => $config_version,
'renderer' => 'networkd'
}
}
netplan::install
Install Netplan package
Examples
include netplan::install
Defined types
netplan::interface
Create interface $dev
Examples
netplan::interface { 'ens3': addresses => ['192.168.0.1'] }
Parameters
The following parameters are available in the netplan::interface
defined type:
type
Data type: String
Type of device
Default value: 'ethernets'
dev
Data type: String
Device name
Default value: $name
addresses
Data type: Array
Default value: []
flush
Data type: Boolean
Deletes all addresses on the interface before applying the new configuration
Default value: false
opts
Data type: Hash
Default value: {}
netplan::route
Create route for $dev interface
Examples
netplan::route { 'Added new route for Office net': dev => 'ens3', to => '172.10.0.1', via => '192.168.0.1' }
Parameters
The following parameters are available in the netplan::route
defined type:
dev
Data type: String
to
Data type: String
via
Data type: String
type
Data type: String
Default value: 'ethernets'
opts
Data type: Hash
Default value: {}
Functions
core_netplan::get::type
Type: Puppet Language
See https://puppet.com/docs/puppet/latest/lang_write_functions_in_puppet.html for more information on native puppet functions.
core_netplan::get::type(String $type)
See https://puppet.com/docs/puppet/latest/lang_write_functions_in_puppet.html for more information on native puppet functions.
Returns: String
String
type
Data type: String
Dependencies
- puppetlabs/stdlib (>= 4.13.1 < 10.0.0)
- puppetlabs/concat (>= 7.4.0 < 9.0.0)