Ask Your Question
0

How to force Facter not to use private ip address?

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

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:172.17.42.1  Bcast:0.0.0.0  Mask:255.255.0.0

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
1

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

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

Comments

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 -0500 )edit

Looks like a bug has been submitted : https://tickets.puppetlabs.com/browse/FACT-380 , it's the closest I can find on the topic.

Julien R. gravatar imageJulien R. ( 2014-09-11 11:01:16 -0500 )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

Stats

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

Seen: 1,585 times

Last updated: Feb 06 '14