<?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>divisionbyzero &#187; linux</title>
	<atom:link href="http://divisionbyzero.net/blog/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://divisionbyzero.net/blog</link>
	<description>question . authority</description>
	<lastBuildDate>Tue, 06 Jul 2010 16:43:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>From cfEngine to Puppet:  A retrospective</title>
		<link>http://divisionbyzero.net/blog/2009/01/18/from-cfengine-to-puppet-a-retrospective/</link>
		<comments>http://divisionbyzero.net/blog/2009/01/18/from-cfengine-to-puppet-a-retrospective/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 02:06:57 +0000</pubDate>
		<dc:creator>brad</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[cfengine]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[puppet]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://divisionbyzero.net/blog/?p=74</guid>
		<description><![CDATA[For several years I&#8217;ve managed to bend cfEngine 2.0&#8242;s architecture to my will.  Being an experienced Perl programmer, I was able to abuse the configuration language snytax in order to accomplish a number of strange things including Copy Back and automated management of OSSEC-HIDS.  However, there comes a point when the managing the cfengine configs [...]]]></description>
			<content:encoded><![CDATA[<p>For several years I&#8217;ve managed to bend <a href="http://www.cfengine.org/" target="_blank">cfEngine</a> 2.0&#8242;s architecture to my will.  Being an experienced Perl programmer, I was able to abuse the configuration language snytax in order to accomplish a number of strange things including <a href="http://divisionbyzero.net/blog/2007/05/03/copy-back-with-cfengine/" target="_blank">Copy Back</a> and <a href="http://www.ossec.net/wiki/index.php/Integration_%26_Deployment_with_cfengine">automated management of</a><a href="http://www.ossec.net/" target="_blank"> OSSEC-HIDS</a>.  However, there comes a point when the managing the cfengine configs becomes a burdensome and incredibly unmanageable.   I mean, sure, I know what they do.  How will any of my co-workers understand them?</p>
<p>After several colleagues recommending <a href="http://puppet.reductivelabs.com">Puppet</a>, I hesitantly began the slow, brain fscking process of:</p>
<ol>
<li>Understanding exactly what I had accomplished with cfEngine.</li>
<li>Understanding Ruby (ugh, I&#8217;m so thankful for Perl)</li>
<li>Understanding how to express my cfengine feelings in a way Puppet will understand without hurting it&#8217;s feelings</li>
<li>&#8230;</li>
<li>Profit.</li>
</ol>
<p><span id="more-74"></span>cfEngine makes some things incredibly easy to manage.  Nearly every command allows you to &#8220;define&#8221; new classes based on various conditions.  This allows to modify a configuration file, and then tell the daemon associated with that config file to restart.  However, when I needed to do something highly specialized, I had to create a shell script, copy the shell script to the server and then run the shell script.  Passing data back to do something was possible, though it seemed a bit hacky.  It separated the customized actions being performed from the dependent actions in the cfEngine configs.  If I had to go back later and make changes, I had to look at both the .cf file and the custom shell script in a completely different directory.</p>
<p>With Puppet, these things can be done relatively simply inside the same class file.  Also, Puppet can be extended simply through the use of defines (think macros) or complexly through the use of modules.  Additionally, Puppet supports templating, classes, inheritance, and explicit order.  Where with cfengine I&#8217;d have to do something like this:</p>
<pre style="padding-left: 30px; ">copy:
  s_snmpd.dc_has_snmp::
     $(distribute)/snmpd.conf	dest=/etc/snmp/snmpd.conf mode=644</pre>
<pre style="padding-left: 30px; ">				server=$(policyhost)
				type=sum
				define=dc_restart_snmpd</pre>
<pre style="padding-left: 30px; ">shellcommands:
   s_snmpd.dc_restart_snmpd::
	"/sbin/service snmpd restart"</pre>
<div>Utilizing the intermediary &#8220;dc_restart_snmpd&#8221; class.   With Puppet I can explicitly define the relationship with the config file and service:</div>
<pre>
<div style="padding-left: 30px; ">class ssh {</div>
<div style="padding-left: 30px; ">    package {</div>
<div style="padding-left: 30px; ">        [ "openssh-clients", "openssh-server" ]:</div>
<div style="padding-left: 30px; ">        ensure =&gt; latest</div>
<div style="padding-left: 30px; ">    }</div>
<div style="padding-left: 30px; ">    file { "/etc/ssh/sshd_config":
        mode  =&gt; 0600,
        owner =&gt; root,
        group =&gt; root,
        mode =&gt; 644,
        require =&gt; Package["openssh-server"],
        content =&gt; template("sshd_config.erb")
    }</div>
<div style="padding-left: 30px; ">    service { sshd:
        subscribe =&gt; File["/etc/ssh/sshd_config"],
        ensure    =&gt; running,
        enable    =&gt; true
    }
}</div>

 </pre>
<p>With this syntax it&#8217;s easy to read that the file /etc/ssh/sshd_config is dependent on the openssh-server package and that the sshd service is dependent on that file.  Puppet also feels more &#8220;cross-platform&#8221; as the &#8220;service&#8221; directive allows me to abstractly describe the service without having to hard code a call to /sbin/service.</p>
<p>Puppet is not without it&#8217;s drawbacks.  The first of which is that it is Ruby.  If you&#8217;re not using Ruby on your systems, this means more package installations on those servers.  If you&#8217;ve been programming in another language, like Perl or Python, it&#8217;s another language you have to fight with.  The memory usage is much higher than I expected.  On some virtual servers, this may be a huge drawback. Consider:</p>
<div id="attachment_85" class="wp-caption alignnone" style="width: 312px"><img class="size-full wp-image-85 " title="puppetmasterd" src="http://divisionbyzero.net/blog/wp-content/uploads/2009/01/puppetmasterd.png" alt="puppetmasterd" width="302" height="209" /><p class="wp-caption-text">Memory usage for puppetmasterd</p></div>
<p>Not too bad, but this is shocking:</p>
<div id="attachment_84" class="wp-caption alignnone" style="width: 312px"><img class="size-full wp-image-84 " title="puppetd" src="http://divisionbyzero.net/blog/wp-content/uploads/2009/01/puppetd.png" alt="Memory Usage at 300 MB prior to restart" width="302" height="209" /><p class="wp-caption-text">Memory Usage at ~250 MB prior to restart</p></div>
<p>Compare this to cfegine:</p>
<p> </p>
<div id="attachment_82" class="wp-caption alignnone" style="width: 311px"><img class="size-full wp-image-82 " title="cfservd" src="http://divisionbyzero.net/blog/wp-content/uploads/2009/01/cfservd.png" alt="Memory Usage for cfservd, Yes, Memory Leak." width="301" height="208" /><p class="wp-caption-text">Memory Usage for cfservd, Yes, Memory Leak.</p></div>
<p>and:</p>
<div id="attachment_81" class="wp-caption alignnone" style="width: 312px"><img class="size-full wp-image-81 " title="cfexed" src="http://divisionbyzero.net/blog/wp-content/uploads/2009/01/cfexed.png" alt="Memory Usage for cfexecd" width="302" height="210" /><p class="wp-caption-text">Memory Usage for cfexecd</p></div>
<p>Hell, even a long running Perl program using POE and Net::Pcap to decode all packets on our uplink at work (which bursts to ~75mb/sec) isn&#8217;t using that much memory:</p>
<div id="attachment_83" class="wp-caption alignnone" style="width: 313px"><img class="size-full wp-image-83 " title="perl-poe" src="http://divisionbyzero.net/blog/wp-content/uploads/2009/01/perl-poe.png" alt="Memory Usage for PoCo::Pcap based Traffic Inspector" width="303" height="208" /><p class="wp-caption-text">Memory Usage for PoCo::Pcap based Traffic Inspector</p></div>
<p>Ultimately, RAM is cheap and my time is expensive.  After kludging together configuration management in cfengine for the past three years, I&#8217;ve decided to ditch it in favor of a more sane and extensible configuration with Puppet.  I&#8217;ve got a lot to learn about Puppet still, so as I learn new and more exciting things and Puppet grows, I&#8217;ll be sure to share how it&#8217;s helping.</p>
]]></content:encoded>
			<wfw:commentRss>http://divisionbyzero.net/blog/2009/01/18/from-cfengine-to-puppet-a-retrospective/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
