1

Is there a way to fix this? Can I change the interfaces order? I have a lot of puppet modules that use $::ipaddress, works fine on CentOS 6 with docker but no on 7

interfaces => docker0,eno16780032,lo
ipaddress => 172.17.42.1
ipaddress_docker0 => 172.17.42.1
ipaddress_eno16780032 => 10.251.17.170
ipaddress_lo => 127.0.0.1
user2363318
  • 361
  • 1
  • 3
  • 11

1 Answers1

2

This is a problem with the default ipaddress fact, it's a bit dumb. We use a custom one called default_if which is based on the default route (works on Debian, may need adapting to CentOS):

Facter.add("default_if") do
    confine :kernel => :linux
    setcode do
        return nil unless FileTest.exists?("/sbin/ip")
        output = %x{/sbin/ip route list match 0.0.0.0}.split("\n")[0]
        output.sub(/.*\s*dev\s+([^\s]+)\s*.*/, '\1')
    end
end
Alex Forbes
  • 2,452
  • 2
  • 20
  • 26