Fork me on GitHub

Puppet addons

I have made some extension for Facter to match my requirements. Most of these extensions are only useful for Gentoo installations. Please leave a comment if you like the addons.

gcc_profile.rb

 

Facter plugin to get the currently active GCC profile on Gentoo installations. It may work on other distributions too.

gcc_profile screenshot

 

Facter.add(:gcc_profile) do
    confine :operatingsystem => :Gentoo
    setcode do
        profile = nil
        output = %x{/usr/bin/gcc-config -c}
        profile = output.chop!
        profile
    end
end

system_profile.rb

 

Facter plugin to get the currently active Gentoo system profile. Plugin uses eselect so you need to have it installed.

system profile

 

Facter.add(:system_profile) do
    confine :operatingsystem => :Gentoo
    setcode do
        profile = nil
        output = %x{/usr/bin/eselect --brief --no-color profile show | tr -d ' '}
        profile = output.chop!
        profile
    end
end

default_gw.rb

 

Facter plugin to return the deault gw set in systems routing table. Requires iproute2 package installed.

Facter.add(:default_gw) do
    confine :kernel => :linux
    setcode do
        gw = nil
        output = %x{/sbin/ip route show}
 
        output.each { |line|
            if line =~ /^default\s+via\s+([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/
                gw = $1
                break
            end
        }
        gw
    end
end

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Comment Spam Protection by WP-SpamFree