On 21.11.2013 13:32, cko wrote:
> Hi,
>
> I'm currently trying to solve the following problem:
>
> I wrote a module that matches the "$ipaddress" fact for certain IP
> subnets (like 20.20.2... or 30.30.2..). Depending on the subnet, the
> variable $proxy-server changes.
>
> The problem is, that
the has_ip_network function that's part of puppet-stdlib may help, it
matches all interfaces against a network address and return a boolean if a
match is found.
https://github.com/puppetlabs/puppetlabs-stdlib#has_ip_network
On 3 December 2013 04:18, jcbollinger wrote:
>
>
> On Friday, November
On Friday, November 29, 2013 5:46:11 AM UTC-6, cko wrote:
>
> Thanks, i think i got something here:
>
> Facter.add("ip_prodlan") do
>confine :kernel => "Linux"
>setcode do
> Facter::Util::Resolution.exec("/sbin/ifconfig | /bin/grep
> '20.20.\\|30.31.\\|200.30.80.\\|120.' | /bin/awk
Thanks, i think i got something here:
Facter.add("ip_prodlan") do
confine :kernel => "Linux"
setcode do
Facter::Util::Resolution.exec("/sbin/ifconfig | /bin/grep
'20.20.\\|30.31.\\|200.30.80.\\|120.' | /bin/awk '{ print $2 }' | /bin/cut
-d':' -f2 | /usr/bin/head -n1")
end
end
I'm
Yep, write it out as such :) Either if/then in the manifest, or write a custom
function that iterates through all ipaddress facts.
On Nov 21, 2013, at 4:32 AM, cko wrote:
> I'm currently trying to solve the following problem:
>
> I wrote a module that matches the "$ipaddress" fact for certain