Hi,
This has been driving me crazy the past few days. Foreman cannot keep
interfaces straight.
For example, I provision with PXE a VM with two interfaces
52:54:00:24:67:a4/192.168.25.105 (eth0) and the other (ens8) is not
added to Foreman. The PXE build and continued DHCP for eth0 works
great. Then, I go about setting up Openvswitch, which creates
additional interfaces.
Now it's time to rebuild this system, and that's where the trouble
starts. Here is the final interface configuration before rebuilding.
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP mode DEFAULT qlen 1000
link/ether 52:54:00:24:67:a4 brd ff:ff:ff:ff:ff:ff
3: ens8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP mode DEFAULT qlen 1000
link/ether 52:54:00:92:43:8b brd ff:ff:ff:ff:ff:ff
4: ens8.26@ens8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
noqueue state UP mode DEFAULT
link/ether 52:54:00:92:43:8b brd ff:ff:ff:ff:ff:ff
10: ovs-system: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
mode DEFAULT
link/ether 72:ae:da:63:0b:20 brd ff:ff:ff:ff:ff:ff
11: br-ex: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state
UNKNOWN mode DEFAULT
link/ether 3a:0f:92:32:e7:4f brd ff:ff:ff:ff:ff:ff
12: br-int: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state
UNKNOWN mode DEFAULT
link/ether 9a:ba:b9:2a:99:45 brd ff:ff:ff:ff:ff:ff
13: br-tun: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state
UNKNOWN mode DEFAULT
In Foreman, the primary interface has magically changed to
3a:0f:92:32:e7:4f/192.168.26.10. That doesn't make even the slightest
bit of sense. The MAC is for br-ex, which doesn't have an IP address
assigned. The IP is for ens8.26, which has a different MAC.
Foreman has not propagated this incorrect interface to dhcpd, so when
I try to correct the interface settings, I get errors about a
duplicate dhcp lease. Foreman cannot correct this situation (why
not?), so I have to manually edit /var/lib/dhcpd/dhcpd.leases*.
I suppose that facter is the source of the problem:
ipaddress => 192.168.26.10
ipaddress_ens8_26 => 192.168.26.10
ipaddress_eth0 => 192.168.25.105
ipaddress_lo => 127.0.0.1
macaddress => 3a:0f:92:32:e7:4f
macaddress_br_ex => 3a:0f:92:32:e7:4f
macaddress_br_int => 9a:ba:b9:2a:99:45
macaddress_br_tun => 4e:3c:fa:cc:c4:4b
macaddress_ens8 => 52:54:00:92:43:8b
macaddress_ens8_26 => 52:54:00:92:43:8b
macaddress_eth0 => 52:54:00:24:67:a4
macaddress_ovs_system => 72:ae:da:63:0b:20
It seems that facter decides the generic macaddress and ipaddress by
using the first specific field sorted by alphabetical order.
I guess facter needs to have some method to decide the generic field,
but it seems very wrong for Foreman to use this same methodology.
Basically, Foreman says that the primary interface is the interface
with the first name alphabetically and doesn't care what you say once
Puppet runs once.
Thanks,
Justin