Hi

On Nov 28, 11:18 am, Arnau Bria <[EMAIL PROTECTED]> wrote:
> So, if host has an odd IP, primary interface must be eth1, if not, it
> must be eth0:

You can write a custom fact to do it:

Facter.add("primaryint") do
  setcode do
    ip = Facter.value(:ipaddress)
    int_number = ip.split(/\./).last.to_i % 2
    "eth#{int_number}"
  end
end

[EMAIL PROTECTED] ~]$ facter ipaddress
172.31.42.140
[EMAIL PROTECTED] ~]$ facter primaryint
eth0

Follow the instructions at http://reductivelabs.com/trac/puppet/wiki/AddingFacts
to distribute facts to your clients.

Cheers,

Mark
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to