Ask Your Question

How to force Facter not to use private ip address?

asked 2014-02-03 15:02:18 -0600

deric gravatar image

After adding docker interface all servers have the same :ipaddress fact. It seems that Facter is using the very first alphabetically sorted interface as the primary one.

docker0   Link encap:Ethernet  HWaddr 12:de:2d:b1:9d:14
      inet addr:  Bcast:  Mask:

eth0      Link encap:Ethernet  HWaddr 00:25:90:d1:d1:7a
      inet addr: ...

Is there a way how to prohibit getting ip address from virtual interfaces like docker0, lxcbr0, veth6EGAAE?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-02-06 17:15:40 -0600

Stefan gravatar image

The way it currently works is that facter runs ifconfig and returns the first ipaddress that does not start with 127. So to answer your question: No it is not possible right now.

There are three options now:

  1. File a bugreport if you feel that facter should ommit certain interface names when obtaining the ipaddress
  2. Write a custom fact ipaddress_primary that returns your desired value (look at ipaddress.rb in the facter installation directory to get the base idea on how to do that)
  3. Use ipaddress_eth0 instead of ipaddress if eth0 is always your primary interface.
edit flag offensive delete link more


Yes, I think it's a bug. I try to write modules with ipaddress fact as parameter, so that anyone can change which interface will be used.

deric gravatar imagederic ( 2014-03-13 09:06:03 -0600 )edit

Looks like a bug has been submitted : , it's the closest I can find on the topic.

Julien R. gravatar imageJulien R. ( 2014-09-11 11:01:16 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-02-03 15:02:18 -0600

Seen: 2,562 times

Last updated: Feb 06 '14