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: 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/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 diff --git a/templates/network.erb b/templates/network.erb index d3ce54a4..ce073025 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=yes +<% end -%> <% end -%> <% if @hostname %>HOSTNAME=<%= @hostname %> <% else %>HOSTNAME=<%= scope.lookupvar('::fqdn') %>