<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>My two ¢&#039;s &#187; facter</title>
	<atom:link href="http://www.linuxaddicted.de/blog/tag/facter/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.linuxaddicted.de/blog</link>
	<description>A Gentoo addict, linux admin and developer</description>
	<lastBuildDate>Wed, 31 Mar 2010 12:12:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Puppet addons</title>
		<link>http://www.linuxaddicted.de/blog/projects/puppet-addons/</link>
		<comments>http://www.linuxaddicted.de/blog/projects/puppet-addons/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 21:26:57 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[facter]]></category>
		<category><![CDATA[puppet]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.linuxaddicted.de/blog/?page_id=267</guid>
		<description><![CDATA[<p>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.</p> <p></p> gcc_profile.rb <p>&#160;</p> <p>Facter plugin to get the currently active GCC profile on Gentoo installations. It may work on other distributions too.</p> <p></p> <p>&#160;</p> <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.linuxaddicted.de/blog/projects/puppet-addons/">Puppet addons</a></span>]]></description>
			<content:encoded><![CDATA[<p>I have made some extension for <a href="http://projects.reductivelabs.com/projects/facter">Facter</a> to match my requirements. Most of these extensions are only useful for Gentoo installations. Please leave a comment if you like the addons.</p>
<p><!-- more --></p>
<h2>gcc_profile.rb</h2>
<p>&nbsp;</p>
<p>Facter plugin to get the currently active GCC profile on <a href="http://www.gentoo.org">Gentoo</a> installations. It may work on other distributions too.</p>
<p><img class="aligncenter size-full wp-image-274" title="gcc_profile screenshot" src="http://www.linuxaddicted.de/blog/wp-content/uploads/2010/01/Picture-20.png" alt="gcc_profile screenshot" width="421" height="43" /></p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">Facter.<span style="color:#9900CC;">add</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:gcc_profile</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    confine <span style="color:#ff3333; font-weight:bold;">:operatingsystem</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:Gentoo</span>
    setcode <span style="color:#9966CC; font-weight:bold;">do</span>
        profile = <span style="color:#0000FF; font-weight:bold;">nil</span>
        output = <span style="color:#006600; font-weight:bold;">%</span>x<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">/</span>usr<span style="color:#006600; font-weight:bold;">/</span>bin<span style="color:#006600; font-weight:bold;">/</span>gcc<span style="color:#006600; font-weight:bold;">-</span>config <span style="color:#006600; font-weight:bold;">-</span>c<span style="color:#006600; font-weight:bold;">&#125;</span>
        profile = output.<span style="color:#CC0066; font-weight:bold;">chop!</span>
        profile
    <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<h2>system_profile.rb</h2>
<p>&nbsp;</p>
<p>Facter plugin to get the currently active <a href="http://www.gentoo.org">Gentoo</a> system profile. Plugin uses eselect so you need to have it installed.</p>
<p><img class="aligncenter size-full wp-image-285" title="system profile" src="http://www.linuxaddicted.de/blog/wp-content/uploads/2010/01/Picture-21.png" alt="system profile" width="312" height="55" /></p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">Facter.<span style="color:#9900CC;">add</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:system_profile</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    confine <span style="color:#ff3333; font-weight:bold;">:operatingsystem</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:Gentoo</span>
    setcode <span style="color:#9966CC; font-weight:bold;">do</span>
        profile = <span style="color:#0000FF; font-weight:bold;">nil</span>
        output = <span style="color:#006600; font-weight:bold;">%</span>x<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">/</span>usr<span style="color:#006600; font-weight:bold;">/</span>bin<span style="color:#006600; font-weight:bold;">/</span>eselect <span style="color:#006600; font-weight:bold;">--</span>brief <span style="color:#006600; font-weight:bold;">--</span>no<span style="color:#006600; font-weight:bold;">-</span>color profile show <span style="color:#006600; font-weight:bold;">|</span> tr <span style="color:#006600; font-weight:bold;">-</span>d <span style="color:#996600;">' '</span><span style="color:#006600; font-weight:bold;">&#125;</span>
        profile = output.<span style="color:#CC0066; font-weight:bold;">chop!</span>
        profile
    <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<h2>default_gw.rb</h2>
<p>&nbsp;</p>
<p>Facter plugin to return the deault gw set in systems routing table. Requires iproute2 package installed.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">Facter.<span style="color:#9900CC;">add</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:default_gw</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    confine <span style="color:#ff3333; font-weight:bold;">:kernel</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:linux</span>
    setcode <span style="color:#9966CC; font-weight:bold;">do</span>
        gw = <span style="color:#0000FF; font-weight:bold;">nil</span>
        output = <span style="color:#006600; font-weight:bold;">%</span>x<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">/</span>sbin<span style="color:#006600; font-weight:bold;">/</span>ip route show<span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
        output.<span style="color:#9900CC;">each</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>line<span style="color:#006600; font-weight:bold;">|</span>
            <span style="color:#9966CC; font-weight:bold;">if</span> line =~ <span style="color:#006600; font-weight:bold;">/</span>^default\s<span style="color:#006600; font-weight:bold;">+</span>via\s<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">9</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">1</span>,<span style="color:#006666;">3</span><span style="color:#006600; font-weight:bold;">&#125;</span>\.<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">9</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">1</span>,<span style="color:#006666;">3</span><span style="color:#006600; font-weight:bold;">&#125;</span>\.<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">9</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">1</span>,<span style="color:#006666;">3</span><span style="color:#006600; font-weight:bold;">&#125;</span>\.<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">9</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006666;">1</span>,<span style="color:#006666;">3</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">/</span>
                gw = $<span style="color:#006666;">1</span>
                <span style="color:#9966CC; font-weight:bold;">break</span>
            <span style="color:#9966CC; font-weight:bold;">end</span>
        <span style="color:#006600; font-weight:bold;">&#125;</span>
        gw
    <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.linuxaddicted.de/blog/projects/puppet-addons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

