I just did something similar to parse out what proxy my client should
use - for a custom fact do:
Facter.add(:network) do
setcode do
srcIP = Facter.value(:ipaddress)
octets = srcIP.split (/\./ )
<logic specific to your use>
end
end
On Jan 19, 7:08 am, <[email protected]> wrote:
> Hi all,
>
> I need my servers to decide which network they are in (i.e. dmz), and
> the only clue is the servers IP-address. I was trying to accomplish it
> like this, but it doesn't work:
>
> case $ipaddress {
>
> "10.1.1.*": {
>
> $network = "net1"
>
> }
>
> "10.2.2.*.*": {
>
> $network = "net2"
>
> }
>
> "10.3.3.*": {
>
> $network = "net3"
>
> }
>
> }
>
> When I change the IP Address to a valid one (like 10.1.1.100) the case
> works and the network variable is set accordingly. What's the correct
> way to do this?
>
> Thanks a bunch,
>
> Sven
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---