From ff4e48c5347c9e8a4747effbb139dbb9469e9d16 Mon Sep 17 00:00:00 2001 From: Keith Burdis Date: Tue, 19 Mar 2013 02:27:05 +0000 Subject: [PATCH] Basic IPv6 support --- Changelog | 7 ++++++- manifests/network.pp | 10 ++++++---- manifests/network/interface.pp | 27 +++++++++++++++++++-------- templates/network/interface.erb | 6 ++++++ templates/network/network.erb | 8 +++++++- 5 files changed, 44 insertions(+), 14 deletions(-) diff --git a/Changelog b/Changelog index 075ad84..cc4a651 100644 --- a/Changelog +++ b/Changelog @@ -7,12 +7,17 @@ * Manage simple mail smart host configuration (initially just Postfix). Mail aliases are now set under 'mail' instead of a separate 'mailaliases'. +* Do not try to set a MAC address on a virtual interface. Instead make virtual +interfaces dependent on their parents (#3 thanks eglis). + +* Added basic IPv6 support (#2 thanks eglis) + 0.7.2: * Realize groups before users so that user primary groups exist when the user is created. -* Make 'include system' work again (thanks mkm85) by avoiding mandatory +* Make 'include system' work again (#1 thanks mkm85) by avoiding mandatory parameters in network and adding checks instead. * Do not restart the network service when config file changes are made as this diff --git a/manifests/network.pp b/manifests/network.pp index 71492dd..77e0bcd 100644 --- a/manifests/network.pp +++ b/manifests/network.pp @@ -1,8 +1,10 @@ class system::network ( - $hostname = undef, - $gateway = undef, - $ipv6 = false, - $zeroconf = false, + $hostname = undef, + $gateway = undef, + $ipv6 = false, + $ipv6init = false, + $ipv6autoconf = true, + $zeroconf = false, ) { if $hostname { validate_string($hostname) diff --git a/manifests/network/interface.pp b/manifests/network/interface.pp index 358b6ca..f0d6997 100644 --- a/manifests/network/interface.pp +++ b/manifests/network/interface.pp @@ -1,12 +1,17 @@ define system::network::interface ( - $dhcp = undef, - $hwaddr = undef, - $hotplug = true, - $ipaddress = undef, - $netmask = undef, - $onboot = true, - $routes = undef, - $type = 'Ethernet', + $dhcp = undef, + $hwaddr = undef, + $hotplug = true, + $ipaddress = undef, + $ipv6init = false, + $ipv6addr = undef, + $ipv6addr_secondaries = undef, + $ipv6autoconf = true, + $netmask = undef, + $onboot = true, + $routes = undef, + $type = 'Ethernet', + $userctl = false, ) { $_interface = $title validate_string($_interface) @@ -48,6 +53,12 @@ else { $_alias = false } + $_ipv6init = $ipv6init + validate_bool($_ipv6init) + $_ipv6addr = $ipv6addr + $_ipv6addr_secondaries = $ipv6addr_secondaries + $_ipv6autoconf = $ipv6autoconf + validate_bool($_ipv6autoconf) file { "/etc/sysconfig/network-scripts/ifcfg-${_interface}": ensure => present, owner => 'root', diff --git a/templates/network/interface.erb b/templates/network/interface.erb index b5d659e..6c5d547 100644 --- a/templates/network/interface.erb +++ b/templates/network/interface.erb @@ -11,3 +11,9 @@ HOTPLUG=<% if @_hotplug %>yes<% else %>no<% end %> TYPE=<%= @_type %> IPADDR=<%= @_ipaddr %> NETMASK=<%= @_netmask %> +<% if @_ipv6init -%> +IPV6INIT=yes +<% if @_ipv6addr %>IPV6ADDR=<%= @_ipv6addr %><% end %> +<% if @_ipv6addr_secondaries %>IPV6ADDR_SECONDARIES=<%= @_ipv6addr_secondaries %><% end %> +IPV6_AUTOCONF=<% if @_ipv6autoconf %>yes<% else %>no<% end %> +<% end -%> diff --git a/templates/network/network.erb b/templates/network/network.erb index b8cf1b8..6c8dfaf 100644 --- a/templates/network/network.erb +++ b/templates/network/network.erb @@ -1,6 +1,12 @@ # File managed by Puppet NETWORKING=yes -NETWORKING_IPV6=<% if @ipv6 %>yes<% else %>no<% end %> HOSTNAME=<%= @hostname %> GATEWAY=<%= @gateway %> NOZEROCONF=<% if @zeroconf %>no<% else %>yes<% end %> +<% if @ipv6 -%> +NETWORKING_IPV6=yes +<% if @ipv6init %>IPV6INIT=yes<% end %> +IPV6_AUTOCONF=<% if @ipv6autoconf %>yes<% else %>no<% end %> +<% else -%> +NETWORKING_IPV6=no +<% end -%>