On May 30, 3:10 pm, Tim Coote <tim.coo...@googlemail.com> wrote: > Hullo > I'm running facter 1.5.8 (fedora 13). I'm not very clear about what > the variable ipaddress is supposed to represent.
I suggest you read the discussion at http://groups.google.com/group/puppet-users/browse_thread/thread/f278468018b13a32, especially Daniel Pittman's response at the end. As Daniel observes, *Facter* is not very clear about what that fact represents. > I've read that it > returns the ip address that's bound to the lowest alphabetic name of a > network interface. That model seems a bit weird to me but that's > probably because I'm just used to tools that return the set of IP > addresses associated with the host, as seen from the host. No, I think it's because you intuitively understand what Daniel wrote, that Facter's ipaddress fact is not well-defined, and it is not very meaningful in the general case. It's not very useful if you have to worry about machines that have more than one non-loopback network interface. It might be even less useful than that. > On one of my machines, ifconfig returns 5 device names which can have > IP addresses associated with them (eth0, lo, virbr0, vmbridge, and > vnet0), of these, eth0 is bridged to vmbridge (and has no IPv4 address > of its own), lo I don't care about, virbr0 is the internal (ie not > visible off the host) bridge created by some libvirt (I think) and I > don't know where vnet0 comes from. > > Facter is returning the IP v4 address on virbr0, which is neither what > the documentation says, nor much use as I can see that it's likely to > be the same on all hosts that have libvirt installed. There are no > IPv6 addresses returned. > > Am I seeing the expected behaviour for facter? Do I have to > standardise how I name network interfaces and associate IP addresses > to them to be able to deal with them all in a consistent, meaningful > way (eg to pick out the IP that's used for backup, or the different IP > addresses connected to the different edge switches)? I'm not sure whether you're seeing the expected behavior. If ifconfig lists an IP address for eth0, then probably not. Otherwise, probably so, though it must be understood that "expected" is not necessarilly the same as "most desirable". I recommend that you reserve twiddling interface names for a last resort. It really shouldn't come to that. I also recommend, however, that you stop using the 'ipaddress' fact. In the words of Inigo Montoya, "I don't think it means what you think it means." Pittman offered an alternative in the discussion I linked above. You might also be able to use one of the per-interface ipaddress facts (e.g. ipaddress_eth0) if that's sensible and if facter is picking it up (check by running facter from the command line on the system in question). If neither of those fits the bill, then a custom fact is pretty easy to write and distribute; that's the Swiss army knife of Facter. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.