From b5a49440a67bf45776ddc3b52fe6f638fde73d98 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Fri, 26 Jan 2018 13:10:26 +0100 Subject: [PATCH 1/4] Make it possible to enable ipv6 forwarding globally --- manifests/global.pp | 4 ++++ templates/network.erb | 2 ++ 2 files changed, 6 insertions(+) diff --git a/manifests/global.pp b/manifests/global.pp index 9ff8c67a..6925fb80 100644 --- a/manifests/global.pp +++ b/manifests/global.pp @@ -22,6 +22,7 @@ # $nisdomain - optional - Configures the NIS domainname. # $vlan - optional - yes|no to enable VLAN kernel module # $ipv6networking - optional - enables / disables IPv6 globally +# $ipv6forwarding - optional - enables / disabled IPv6 forwarding globally # $nozeroconf - optional # $restart - optional - defaults to true # $requestreopen - optional - defaults to true @@ -45,6 +46,7 @@ # nisdomain => 'domain.tld', # vlan => 'yes', # ipv6networking => true, +# ipv6forwarding => true, # nozeroconf => 'yes', # requestreopen => false, # } @@ -70,6 +72,7 @@ $nisdomain = undef, $vlan = undef, $ipv6networking = false, + $ipv6forwarding = false, $nozeroconf = undef, $restart = true, $requestreopen = true, @@ -83,6 +86,7 @@ } validate_bool($ipv6networking) + validate_bool($ipv6forwarding) validate_bool($restart) validate_bool($requestreopen) diff --git a/templates/network.erb b/templates/network.erb index d3ce54a4..ac24b649 100644 --- a/templates/network.erb +++ b/templates/network.erb @@ -8,6 +8,8 @@ NETWORKING=yes <% end -%> <% if @ipv6defaultdev %>IPV6_DEFAULTDEV=<%= @ipv6defaultdev %> <% end -%> +<% if @ipv6forwarding %>IPV6FORWARDING=<%= @ipv6forwarding %> +<% end -%> <% end -%> <% if @hostname %>HOSTNAME=<%= @hostname %> <% else %>HOSTNAME=<%= scope.lookupvar('::fqdn') %> From 438240c62214c728475378e05737598e5ae6fdb5 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Tue, 20 Feb 2018 08:06:12 +0100 Subject: [PATCH 2/4] Better use 'yes', instead of 'true', although it also works --- templates/network.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/network.erb b/templates/network.erb index ac24b649..ce073025 100644 --- a/templates/network.erb +++ b/templates/network.erb @@ -8,7 +8,7 @@ NETWORKING=yes <% end -%> <% if @ipv6defaultdev %>IPV6_DEFAULTDEV=<%= @ipv6defaultdev %> <% end -%> -<% if @ipv6forwarding %>IPV6FORWARDING=<%= @ipv6forwarding %> +<% if @ipv6forwarding %>IPV6FORWARDING=yes <% end -%> <% end -%> <% if @hostname %>HOSTNAME=<%= @hostname %> From a1b4430197f4af297000f6b9c842e1661583e375 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Tue, 20 Feb 2018 08:20:36 +0100 Subject: [PATCH 3/4] Add two tests for ipv6forwarding --- spec/classes/network_global_spec.rb | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/spec/classes/network_global_spec.rb b/spec/classes/network_global_spec.rb index 52318527..7723bc38 100644 --- a/spec/classes/network_global_spec.rb +++ b/spec/classes/network_global_spec.rb @@ -233,5 +233,38 @@ 'NOZEROCONF=yes', ]) end + + context 'ipv6forwarding = foo' do + let(:params) {{ :ipv6forwarding => 'foo' }} + + it 'should fail' do + expect { + should raise_error(Puppet::Error, /$ipv6forwarding is not a boolean. It looks to be a String./) + } + end + end + end + + context 'on a supported operatingsystem, custom parameters' do + let :params do { + :ipv6networking => true, + :ipv6forwarding => true, + } + end + let :facts do { + :osfamily => 'RedHat', + :operatingsystem => 'RedHat', + :operatingsystemrelease => '7.1', + :fqdn => 'localhost.localdomain', + } + end + it 'should contain File[network.sysconfig] with correct contents' do + verify_contents(catalogue, 'network.sysconfig', [ + 'NETWORKING=yes', + 'NETWORKING_IPV6=yes', + 'IPV6FORWARDING=yes', + ]) + end + end end From b98fcce70d021c1c095029b45c8af09b94a49fe4 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Tue, 20 Feb 2018 08:20:53 +0100 Subject: [PATCH 4/4] Add example with IPv6 forwarding enabled --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 3d167aad..46d7c71b 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,12 @@ Global network setting with IPv6 enabled with optional default device for IPv6 t ipv6defaultdev => 'eth1', } +Set IPv6 forwarding globally: + + class { 'network::global': + ipv6networking => true, + ipv6forwarding => true, + } Normal interface - no IP: