On 8 February 2011 07:44, Gabriel Filion <lelu...@gmail.com> wrote: [...] > Is there a way to force facter to chose a specific interface for the > ipaddress value?
Hi, I was wondering *when* would this part of the ipaddress.rb fact code would be used: --(0)> tail -20 /usr/lib/ruby/site_ruby/1.8/facter/ipaddress.rb Facter.add(:ipaddress, :timeout => 2) do setcode do if hostname = Facter.value(:hostname) # we need Hostname to exist for this to work host = nil if host = Facter::Util::Resolution.exec("host #{hostname}") list = host.chomp.split(/\s/) if defined? list[-1] and list[-1] =~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ list[-1] end else nil end else nil end end end --(naresh.ve@puppet)-(~)-- --(0)> irb -rfacter irb(main):001:0> Facter::Util::Resolution.exec("host puppet.domain.com") => "puppet.directi.com has address a.b.c.d" irb(main):002:0> host = Facter::Util::Resolution.exec("host puppet.domain.com") => "puppet.directi.com has address a.b.c.d" irb(main):003:0> list = host.chomp.split(/\s/) => ["puppet.directi.com", "has", "address", "a.b.c.d"] irb(main):004:0> if defined? list[-1] and list [-1] =~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ irb(main):005:1> list[-1] irb(main):006:1> end => "a.b.c.d" irb(main):007:0> (masked my IP with a.b.c.d) If this part were the default/first piece of code that'd be used to produce the ipaddress fact, setting the right A record for the fqdn should solve the problem? -Naresh -- 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.