Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/puppet 6 #153

Open
wants to merge 50 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
497078b
Remove support for Puppet <4.9.0
pmuller Feb 19, 2018
12d3127
Use typing in network::if
pmuller Feb 19, 2018
4f90844
Use lookup() instead of hiera_hash()
pmuller Feb 19, 2018
81cb363
Use typing in network::bridge
pmuller Feb 19, 2018
9505bed
Use typing in network::alias
pmuller Feb 19, 2018
3e67b7a
Use typing in network::alias::range
pmuller Feb 19, 2018
11fcab2
Use typing in network::bond
pmuller Feb 19, 2018
d68acaa
Use typing in network::if::bridge
pmuller Feb 19, 2018
d5e3b71
Use typing in network::if::static
pmuller Feb 19, 2018
62e3a94
Use typing in network::if::promisc
pmuller Feb 19, 2018
674be8e
Use typing in network::if::dynamic
pmuller Feb 19, 2018
a63a23d
Fixures: fix ref for thrnio/ip
pmuller Feb 19, 2018
7b83769
Use typing in network::bond::bridge
pmuller Feb 19, 2018
4d7f15d
Use typing in network::bond::slave
pmuller Feb 19, 2018
046a380
Use typing in network::bond::static
pmuller Feb 19, 2018
7c8e5b3
Use typing in network::bond::dynamic
pmuller Feb 19, 2018
2b7d2f6
Use typing in network::route
pmuller Feb 19, 2018
11de7c1
Use typing in network::global
pmuller Feb 19, 2018
0e95a0c
Use typing in network::bridge::static
pmuller Feb 19, 2018
522959e
Use typing in network::bridge::dynamic
pmuller Feb 19, 2018
6fef947
Use typing in network_if_base
pmuller Feb 19, 2018
43b3bc8
Simplify if statement
pmuller Feb 19, 2018
2131838
Remove useless calls to validate_* functions
pmuller Feb 19, 2018
335a120
Use thrnio/ip types instead of stdlib types
pmuller Feb 19, 2018
020ef28
Prevent rspec output truncation
pmuller Feb 19, 2018
9cc223b
Add type Network::If::Bootproto
pmuller Feb 19, 2018
5f38177
Accept thrnio/ip 1.0.0
pmuller Feb 19, 2018
7bcb6b8
Stop using $::macaddress_* legacy facts
pmuller Feb 19, 2018
220aa34
Stop using $::osfamily and $::operatingsystem* legact facts
pmuller Feb 19, 2018
4fc403b
Remove rspec output truncation hack
pmuller Feb 19, 2018
03c72f5
Tests: no longer allow failures for Puppet 5
pmuller Feb 19, 2018
0834c90
Fix tests for Puppet 4
pmuller Feb 19, 2018
4b69dde
Update README
pmuller Feb 19, 2018
44b0ef4
Use EPP in network::route
pmuller Feb 20, 2018
086ed5c
Use EPP in network_if_base for ifcfg-alias
pmuller Feb 20, 2018
81c922c
Use EPP in network::alias::range
pmuller Feb 20, 2018
a2e133b
Use EPP in network::bond::slave
pmuller Feb 20, 2018
7db97fa
Use EPP in network::bridge
pmuller Feb 20, 2018
647e94f
Use EPP in network::global
pmuller Feb 20, 2018
86a4349
Use EPP in network_if_base for ifcfg-eth
pmuller Feb 20, 2018
c3c6b44
Tests: remove useless facts
pmuller Feb 20, 2018
a4359ba
Add augeas_core as dependency for >= Puppet 6
m4rx0 Apr 24, 2019
56cfd92
Add Puppet 6 in CI
m4rx0 Apr 24, 2019
13212eb
Update dependencies and requirements
m4rx0 Apr 24, 2019
0ca1816
Change to Stdlib::IP resource types
m4rx0 Apr 24, 2019
5959959
introduce possibility for interfaces without an ip
m4rx0 Apr 26, 2019
e37beab
Remove restriction for CI jobs
m4rx0 Apr 26, 2019
c34ac77
Adapt CI jobs
m4rx0 Apr 26, 2019
6efb894
Add and fix data types in network::if::none
m4rx0 Apr 26, 2019
4ebb2b4
Bump version
m4rx0 Apr 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
fixtures:
repositories:
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
augeas_core:
repo: "https://github.com/puppetlabs/puppetlabs-augeas_core.git"
puppet_version: ">= 6.0.0"
symlinks:
network: "#{source_dir}"
41 changes: 11 additions & 30 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,18 @@
language: ruby
cache:
directories:
- vendor/bundle
# - spec/fixtures/modules
- vendor/bundle
sudo: false
branches:
only:
- master
- develop
bundler_args: --without system_tests
script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'"
script:
- 'bundle exec rake validate'
- 'bundle exec rake lint'
- 'bundle exec rake spec SPEC_OPTS="--format documentation"'
matrix:
fast_finish: true
include:
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes"
- rvm: 2.1.9
env: PUPPET_GEM_VERSION="~> 4.0"
- rvm: 2.4.1
env: PUPPET_GEM_VERSION="~> 5.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0"
allow_failures:
- rvm: 2.4.1
env: PUPPET_GEM_VERSION="~> 5.0"
notifications:
email:
- [email protected]
- rvm: 2.1.9
env: PUPPET_GEM_VERSION="~> 4.0"
- rvm: 2.4.1
env: PUPPET_GEM_VERSION="~> 5.0"
- rvm: 2.5.0
env: PUPPET_GEM_VERSION="~> 6.0"
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ Normal interface - promiscuous:
ensure => 'up',
}

Normal interface - none:

network::if::none { 'eth1':
ensure => 'up',
}

Aliased interface IPv4:

network::alias { 'eth0:1':
Expand Down Expand Up @@ -195,7 +201,7 @@ Bonded master interface - bridged (the corresponding network::bridge::* may also
Bonded slave interface:

network::bond::slave { 'eth1':
macaddress => $macaddress_eth1,
macaddress => $::networking['interfaces']['eth1']['mac'],
ethtool_opts => 'autoneg off speed 1000 duplex full',
master => 'bond0',
}
Expand Down Expand Up @@ -322,7 +328,7 @@ The Hiera naming substitutes underscore for any secondary double colons, i.e. sp
Notes
-----

* Runs under Puppet 2.7 and later.
* Runs under Puppet 4.9 and later.
* Only works with RedHat-ish systems.
* Read /usr/share/doc/initscripts-*/sysconfig.txt for underlying details.
* Read /usr/share/doc/kernel-doc-*/Documentation/networking/bonding.txt for underlying details.
Expand Down
5 changes: 4 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ and remove the interface.

network::bond::dynamic { "bond2":
slaves => [ "eth4", "eth7", ],
macaddress => [ $macaddress_eth4, $macaddress_eth7, ],
macaddress => [
$::networking['interfaces']['eth4']['mac'],
$::networking['interfaces']['eth7']['mac'],
],
bonding_opts => "mode=active-backup",
mtu => "1500",
ethtool_opts => "speed 100 duplex full autoneg off",
Expand Down
30 changes: 11 additions & 19 deletions manifests/alias.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,18 @@
# Copyright (C) 2011 Mike Arnold, unless otherwise noted.
#
define network::alias (
$ensure,
$ipaddress,
$netmask,
$gateway = undef,
$noaliasrouting = false,
$ipv6address = undef,
$ipv6gateway = undef,
$userctl = false,
$zone = undef,
$metric = undef,
$restart = true,
Enum['up', 'down'] $ensure,
Stdlib::IP::Address::V4::Nosubnet $ipaddress,
Stdlib::IP::Address::V4::Nosubnet $netmask,
Optional[Stdlib::IP::Address::V4::Nosubnet] $gateway = undef,
Boolean $noaliasrouting = false,
Optional[Stdlib::IP::Address::V6] $ipv6address = undef,
Optional[Stdlib::IP::Address::V6::Nosubnet] $ipv6gateway = undef,
Boolean $userctl = false,
Optional[String] $zone = undef,
Optional[String] $metric = undef,
Boolean $restart = true,
) {
# Validate our data
if ! is_ip_address($ipaddress) { fail("${ipaddress} is not an IP address.") }
# Validate our booleans
validate_bool($noaliasrouting)
validate_bool($userctl)

network_if_base { $title:
ensure => $ensure,
Expand All @@ -63,11 +58,8 @@
noaliasrouting => $noaliasrouting,
ipv6address => $ipv6address,
ipv6gateway => $ipv6gateway,
macaddress => '',
bootproto => 'none',
userctl => $userctl,
mtu => '',
ethtool_opts => '',
isalias => true,
zone => $zone,
metric => $metric,
Expand Down
41 changes: 19 additions & 22 deletions manifests/alias/range.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,16 @@
# Copyright (C) 2013 Mike Arnold, unless otherwise noted.
#
define network::alias::range (
$ensure,
$ipaddress_start,
$ipaddress_end,
$clonenum_start,
$noaliasrouting = false,
$restart = true,
$netmask = false,
$broadcast = false,
$arpcheck = true,
Enum['up', 'down', 'absent'] $ensure,
Stdlib::IP::Address::V4::Nosubnet $ipaddress_start,
Stdlib::IP::Address::V4::Nosubnet $ipaddress_end,
String $clonenum_start,
Boolean $noaliasrouting = false,
Boolean $restart = true,
Optional[Stdlib::IP::Address::V4::Nosubnet] $netmask = undef,
Optional[Stdlib::IP::Address::V4::Nosubnet] $broadcast = undef,
Boolean $arpcheck = true,
) {
# Validate our data
if ! is_ip_address($ipaddress_start) { fail("${ipaddress_start} is not an IP address.") }
if ! is_ip_address($ipaddress_end) { fail("${ipaddress_end} is not an IP address.") }
if $netmask and !is_ip_address($netmask) { fail("${netmask} is not an IP address.") }
if $broadcast and !is_ip_address($broadcast) { fail("${broadcast} is not an IP address.") }
# Validate our booleans
validate_bool($noaliasrouting)
validate_bool($restart)
validate_bool($arpcheck)
# Validate our regular expressions
$states = [ '^up$', '^down$', '^absent$' ]
validate_re($ensure, $states, '$ensure must be either "up", "down", or "absent".')

include '::network'

Expand All @@ -82,7 +70,16 @@
owner => 'root',
group => 'root',
path => "/etc/sysconfig/network-scripts/ifcfg-${interface}-range${clonenum_start}",
content => template('network/ifcfg-alias-range.erb'),
content => epp("${module_name}/ifcfg-alias-range.epp", {
ipaddress_start => $ipaddress_start,
ipaddress_end => $ipaddress_end,
clonenum_start => $clonenum_start,
noaliasrouting => $noaliasrouting,
netmask => $netmask,
broadcast => $broadcast,
arpcheck => $arpcheck,
onparent => $onparent,
}),
before => File["ifcfg-${interface}"],
}

Expand Down
29 changes: 10 additions & 19 deletions manifests/bond.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,17 @@
# Copyright (C) 2015 Jason Vervlied, unless otherwise noted.
#
define network::bond (
$ensure,
$mtu = undef,
$ethtool_opts = undef,
$bonding_opts = 'miimon=100',
$zone = undef,
$restart = true,
Enum['up', 'down'] $ensure,
Optional[String] $mtu = undef,
Optional[String] $ethtool_opts = undef,
String $bonding_opts = 'miimon=100',
Optional[String] $zone = undef,
Boolean $restart = true,
) {
# Validate our regular expressions
$states = [ '^up$', '^down$' ]
validate_re($ensure, $states, '$ensure must be either "up" or "down".')

network_if_base { $title:
ensure => $ensure,
ipaddress => '',
netmask => '',
gateway => '',
macaddress => '',
bootproto => 'none',
ipv6address => '',
ipv6gateway => '',
mtu => $mtu,
ethtool_opts => $ethtool_opts,
bonding_opts => $bonding_opts,
Expand All @@ -61,10 +52,10 @@

# Only install "alias bondN bonding" on old OSs that support
# /etc/modprobe.conf.
case $::operatingsystem {
case $::os['name'] {
/^(RedHat|CentOS|OEL|OracleLinux|SLC|Scientific)$/: {
case $::operatingsystemrelease {
/^[45]/: {
case $::os['release']['major'] {
/^[45]$/: {
augeas { "modprobe.conf_${title}":
context => '/files/etc/modprobe.conf',
changes => [
Expand All @@ -79,7 +70,7 @@
}
}
'Fedora': {
case $::operatingsystemrelease {
case $::os['release']['major'] {
/^(1|2|3|4|5|6|7|8|9|10|11)$/: {
augeas { "modprobe.conf_${title}":
context => '/files/etc/modprobe.conf',
Expand Down
29 changes: 10 additions & 19 deletions manifests/bond/bridge.pp
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,17 @@
# Copyright (C) 2013 Mike Arnold, unless otherwise noted.
#
define network::bond::bridge (
$ensure,
$bridge,
$mtu = undef,
$ethtool_opts = undef,
$bonding_opts = 'miimon=100',
$restart = true,
Enum['up', 'down'] $ensure,
String $bridge,
Optional[String] $mtu = undef,
Optional[String] $ethtool_opts = undef,
String $bonding_opts = 'miimon=100',
Boolean $restart = true,
) {
# Validate our regular expressions
$states = [ '^up$', '^down$' ]
validate_re($ensure, $states, '$ensure must be either "up" or "down".')

network_if_base { $title:
ensure => $ensure,
ipaddress => '',
netmask => '',
gateway => '',
macaddress => '',
bootproto => 'none',
ipv6address => '',
ipv6gateway => '',
mtu => $mtu,
ethtool_opts => $ethtool_opts,
bonding_opts => $bonding_opts,
Expand All @@ -63,10 +54,10 @@

# Only install "alias bondN bonding" on old OSs that support
# /etc/modprobe.conf.
case $::operatingsystem {
case $::os['name'] {
/^(RedHat|CentOS|OEL|OracleLinux|SLC|Scientific)$/: {
case $::operatingsystemrelease {
/^[45]/: {
case $::os['release']['major'] {
/^[45]$/: {
augeas { "modprobe.conf_${title}":
context => '/files/etc/modprobe.conf',
changes => [
Expand All @@ -81,7 +72,7 @@
}
}
'Fedora': {
case $::operatingsystemrelease {
case $::os['release']['major'] {
/^(1|2|3|4|5|6|7|8|9|10|11)$/: {
augeas { "modprobe.conf_${title}":
context => '/files/etc/modprobe.conf',
Expand Down
33 changes: 12 additions & 21 deletions manifests/bond/dynamic.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,19 @@
# Copyright (C) 2011 Mike Arnold, unless otherwise noted.
#
define network::bond::dynamic (
$ensure,
$mtu = undef,
$ethtool_opts = undef,
$bonding_opts = 'miimon=100',
$zone = undef,
$defroute = undef,
$metric = undef,
$restart = true,
Enum['up', 'down'] $ensure,
Optional[String] $mtu = undef,
Optional[String] $ethtool_opts = undef,
String $bonding_opts = 'miimon=100',
Optional[String] $zone = undef,
Optional[String] $defroute = undef,
Optional[String] $metric = undef,
Boolean $restart = true,
) {
# Validate our regular expressions
$states = [ '^up$', '^down$' ]
validate_re($ensure, $states, '$ensure must be either "up" or "down".')

network_if_base { $title:
ensure => $ensure,
ipaddress => '',
netmask => '',
gateway => '',
macaddress => '',
bootproto => 'dhcp',
ipv6address => '',
ipv6gateway => '',
mtu => $mtu,
ethtool_opts => $ethtool_opts,
bonding_opts => $bonding_opts,
Expand All @@ -69,10 +60,10 @@

# Only install "alias bondN bonding" on old OSs that support
# /etc/modprobe.conf.
case $::operatingsystem {
case $::os['name'] {
/^(RedHat|CentOS|OEL|OracleLinux|SLC|Scientific)$/: {
case $::operatingsystemrelease {
/^[45]/: {
case $::os['release']['major'] {
/^[45]$/: {
augeas { "modprobe.conf_${title}":
context => '/files/etc/modprobe.conf',
changes => [
Expand All @@ -87,7 +78,7 @@
}
}
'Fedora': {
case $::operatingsystemrelease {
case $::os['release']['major'] {
/^(1|2|3|4|5|6|7|8|9|10|11)$/: {
augeas { "modprobe.conf_${title}":
context => '/files/etc/modprobe.conf',
Expand Down
Loading