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

Allow to enable IPv6 globally #149

Open
wants to merge 19 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
4 changes: 4 additions & 0 deletions manifests/global.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -45,6 +46,7 @@
# nisdomain => 'domain.tld',
# vlan => 'yes',
# ipv6networking => true,
# ipv6forwarding => true,
# nozeroconf => 'yes',
# requestreopen => false,
# }
Expand All @@ -70,6 +72,7 @@
$nisdomain = undef,
$vlan = undef,
$ipv6networking = false,
$ipv6forwarding = false,
$nozeroconf = undef,
$restart = true,
$requestreopen = true,
Expand All @@ -83,6 +86,7 @@
}

validate_bool($ipv6networking)
validate_bool($ipv6forwarding)
validate_bool($restart)
validate_bool($requestreopen)

Expand Down
33 changes: 33 additions & 0 deletions spec/classes/network_global_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions templates/network.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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') %>
Expand Down