I made a custom fact for something kind of similar to this:
require 'facter'
Facter.add("networklocation") do
setcode do
result = case Facter["ipaddress"].value
when /10.241.209/: "209"
else ""
end
result
end
end
It's kind of horrible and I'm kind of terrible at this stuff, but it did let
me make a custom fact that I could then process further. Maybe you can just
do something similar until someone tells you a smarter way!
On Thu, Mar 25, 2010 at 2:27 PM, deet <[email protected]> wrote:
> Hello.
> I'm running facter 1.5.7 and puppet 0.25.4. I'm trying to create a
> manifest that would identify if a host has an IP address in a certain
> subnet. If the host does have an IP in the specified subnet then
> some static route mangling would happen. The desired subnets don't
> align with a an interface name so I can't just check for the
> existence of say network_eth2.
> Facter already contains all the info I would like to use to make my
> decision but I don't know how to ask it. For example facter shows
> this output
>
> network_e1000g0 => 14.9.32.0
> network_e1000g1 => 192.168.70.0
> network_igb0 => 10.55.12.0
>
> And I want to say something like (pseudo code)
> if network_* = 10.55.12.0
> then
> static route magic here
>
> However I can't quite grasp how I would even go about doing this?
>
> My fallback solution is just to do an exec ifconfig, grep, awk etc
> but if facter already has what I want to know I figured I would see if
> someone could help me understand how to ask it for the info.
> Any tips are appreciated.
> TIA. Derek.
>
> --
> 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]<puppet-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>
--
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.