example42/puppet-network

Unclear how to manage Debian/Ubuntu IPv4 IPv6 networking with

Closed this issue · 5 comments

Expected Behavior

On a Debian/Ubuntu systems
restart of network interface by its actual dev name

Actual Behavior

attempts to restart the an interface with the name of the declaration identifier

Steps to Reproduce the Problem

  1. use restart_all_nic => false
  2. Create a structure to support IPv4 and IPv6
eth0v4 => {enable => true, bootproto => none, peerdns => no, userctl => no, restart_all_nic => false, accept_ra => 1, autoconf => 0, type => Ethernet, mtu => 1500, dns_nameservers => X.X.X.1 X.X.X.1 X.X.X.1, interface => eth0, ipaddress => X.X.X.X/22, gateway => X.X.X.1, family => inet}, eth0v6 => {enable => true, bootproto => none, peerdns => no, userctl => no, restart_all_nic => false, accept_ra => 1, autoconf => 0, type => Ethernet, mtu => 1500, dns_nameservers => X.X.X.1 X.X.X.1 X.X.X.1, interface => eth0, ipaddress => X.X.X.1::85/64, gateway => X.X.X.1::1, family => inet6}
  1. run the puppet agent
The error observed without applying the fix:
Notice: /Stage[main]/Network/Network::Interface[eth1v4]/Exec[network_restart_eth1v4]/returns: Unknown interface eth1v4
Notice: /Stage[main]/Network/Network::Interface[eth1v4]/Exec[network_restart_eth1v4]/returns: Unknown interface eth1v4

Specifications

Please add this info:

  1. Output of facter -p on the failing node (at least the OS related facts)
  2. Version of Puppet and of the module
  3. The relevant Puppet code and eventually Hiera data

In order to manage both IPv4 and IPv6 configuration on a Debian / Ubuntu host, one is required to maintain a structure like the one below.
Since it is not possible to create multiple declarations with the same identifier (name), then I believe the fix similar to the proposed one is needed.
I am certain it will not change anything in the way it works.

{eth0:0v4 => {enable => true, bootproto => none, peerdns => no, userctl => no, restart_all_nic => false, accept_ra => 1, autoconf => 0, type => Ethernet, mtu => 1500, interface => eth0:0, ipaddress => X.X.X.X/22, family => inet}, eth0:0v6 => {enable => true, bootproto => none, peerdns => no, userctl => no, restart_all_nic => false, accept_ra => 1, autoconf => 0, type => Ethernet, mtu => 1500, interface => eth0:0, ipaddress => X.X.X.1::85/64, family => inet6}, eth1v4 => {enable => true, bootproto => none, peerdns => no, userctl => no, restart_all_nic => false, accept_ra => 0, autoconf => 0, type => Ethernet, mtu => 1500, ethtool_opts => -K eth1 tx on rx on tso off; -C eth1 rx-usecs 0;, interface => eth1, ipaddress => X.X.X.1/29, family => inet}, eth1v6 => {enable => true, bootproto => none, peerdns => no, userctl => no, restart_all_nic => false, accept_ra => 0, autoconf => 0, type => Ethernet, mtu => 1500, ethtool_opts => -K eth1 tx on rx on tso off; -C eth1 rx-usecs 0;, interface => eth1, ipaddress => X.X.X.1:bb:43::2/64, family => inet6}, eth1.12v4 => {enable => true, bootproto => none, peerdns => no, userctl => no, restart_all_nic => false, accept_ra => 1, autoconf => 0, type => Ethernet, mtu => 1500, vlan => yes, interface => eth1.12, ipaddress => X.X.X.1/29, family => inet}, eth1.12v6 => {enable => true, bootproto => none, peerdns => no, userctl => no, restart_all_nic => false, accept_ra => 1, autoconf => 0, type => Ethernet, mtu => 1500, vlan => yes, interface => eth1.12, ipaddress => X.X.X.1:dd:3::2/64, family => inet6}, eth0v4 => {enable => true, bootproto => none, peerdns => no, userctl => no, restart_all_nic => false, accept_ra => 1, autoconf => 0, type => Ethernet, mtu => 1500, dns_nameservers => X.X.X.1 X.X.X.1 X.X.X.1, interface => eth0, ipaddress => X.X.X.X/22, gateway => X.X.X.1, family => inet}, eth0v6 => {enable => true, bootproto => none, peerdns => no, userctl => no, restart_all_nic => false, accept_ra => 1, autoconf => 0, type => Ethernet, mtu => 1500, dns_nameservers => X.X.X.1 X.X.X.1 X.X.X.1, interface => eth0, ipaddress => X.X.X.1::85/64, gateway => X.X.X.1::1, family => inet6}}

Here is an example structure on how to manage IPv4 and IPv6 configuration for Debian. Please note there still might be some minor deficiencies, which will be corrected, when I have a live deployment.

{
eth0:0v4 => {enable => true,
bootproto => none,
peerdns => no,
userctl => no,
restart_all_nic => false,
accept_ra => 1,
type => Ethernet,
mtu => 1500,
interface => eth0:0,
ipaddress => X.X.X.X/22,
family => inet},

eth0:0v6 => {enable => true,
bootproto => none,
peerdns => no,
userctl => no,
restart_all_nic => false,
accept_ra => 1,
autoconf => 0,
type => Ethernet,
mtu => 1500,
interface => eth0:0,
ipaddress => X.X.X.1::85/64,
family => inet6},

eth1v4 => {enable => true,
bootproto => none,
peerdns => no,
userctl => no,
restart_all_nic => false,
accept_ra => 0,
type => Ethernet,
mtu => 1500,
interface => eth1,
ipaddress => X.X.X.1/29,
family => inet},

eth1v6 => {enable => true,
bootproto => none,
peerdns => no,
userctl => no,
restart_all_nic => false,
accept_ra => 0,
type => Ethernet,
mtu => 1500,
interface => eth1,
ipaddress => X.X.X.1:bb:43::2/64,
family => inet6},

eth1.12v4 => {enable => true,
bootproto => none,
peerdns => no,
userctl => no,
restart_all_nic => false,
accept_ra => 1,
type => Ethernet,
mtu => 1500,
vlan => yes,
interface => eth1.12,
ipaddress => X.X.X.1/29,
family => inet},

eth1.12v6 => {enable => true,
bootproto => none,
peerdns => no,
userctl => no,
restart_all_nic => false,
accept_ra => 1,
autoconf => 0,
type => Ethernet,
mtu => 1500,
vlan => yes,
interface => eth1.12,
ipaddress => X.X.X.1:dd:3::2/64,
family => inet6},

eth0v4 => {enable => true,
bootproto => none,
peerdns => no,
userctl => no,
restart_all_nic => false,
accept_ra => 1,
type => Ethernet,
mtu => 1500,
dns_nameservers => X.X.X.1 X.X.X.1 X.X.X.1,
interface => eth0,
ipaddress => X.X.X.X/22,
gateway => X.X.X.1,
family => inet},

eth0v6 => {enable => true,
bootproto => none,
peerdns => no,
userctl => no,
restart_all_nic => false,
accept_ra => 1,
autoconf => 0,
type => Ethernet,
mtu => 1500,
interface => eth0,
ipaddress => X.X.X.1::85/64,
gateway => X.X.X.1::1,
family => inet6}
}

@igarny thanks for the note, it would be great to have this added in the README or somethere in the module, for example in a sample manifest under tests/.

The documentation lacks Hiera data samples, which are actually the most common use cases, that's something to improve definitively.

thanks for the pr