[Puppet Users] Re: facter or ifconfig to find hosts with ip on certain subnet

2010-03-29 Thread donavan
On Mar 28, 8:47 pm, deet wrote: >   I like the idea of accessing this information through facter instead > of needlessly running ifconfig again. Indeed. Take a look at the facter libraries, they're quite readable overall. Plenty of good bits in 'facter/util' that you can use also. >  Is their an

[Puppet Users] Re: facter or ifconfig to find hosts with ip on certain subnet

2010-03-28 Thread deet
>             interfaces = Facter.value(:interfaces).split(',') >             nsd_gateway = nil I like the idea of accessing this information through facter instead of needlessly running ifconfig again. >             interfaces.each do |iface| >                 next unless (address = > Facte

[Puppet Users] Re: facter or ifconfig to find hosts with ip on certain subnet

2010-03-26 Thread donavan
> host has one).  I've not ventured down the custom fact road before so > this should be an little adventure. Your version certainly will work. I think this is how I might take a stab at it though: require 'facter' require 'ipaddr' require 'yaml' Facter.add("nsd_gateway") do setcode do

[Puppet Users] Re: facter or ifconfig to find hosts with ip on certain subnet

2010-03-26 Thread deet
> From this example you're trying to detect it any interface is on the > 10.55.12.0 network, That's correct. I have 4 specific subnet's I'm looking for in this example. A host may have zero interfaces on one of the specific subnets or just 1. I was wanting to return the ipaddress that the

[Puppet Users] Re: facter or ifconfig to find hosts with ip on certain subnet

2010-03-26 Thread donavan
>    And I want to say something like (pseudo code) >   if network_* = 10.55.12.0 >   then >   static route magic here >From this example you're trying to detect it any interface is on the 10.55.12.0 network, correct? Are you also trying to match a set of networks (10.55.12.0, 10.55.13.0, etc) wit