<?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>Silas Sewell - Ruby</title>
        <atom:link href="http://www.silassewell.com/blog/tag/ruby/rss2.xml" rel="self" type="application/rss+xml" />
        <link>http://www.silassewell.com/blog/tag/ruby</link>
        <description>Infrastructure Development</description>
        <lastBuildDate>Sat, 08 Jan 2011 00:00:00 GMT</lastBuildDate>
        <generator>http://www.silassewell.com/</generator>
        <language>en</language>
        <sy:updatePeriod>hourly</sy:updatePeriod>
        <sy:updateFrequency>1</sy:updateFrequency>

        <item>
            <title>Managing Large Networks with Puppet</title>
            <link>http://www.silassewell.com/blog/2009/05/04/managing-large-networks-with-puppet/</link>
            <pubDate>Mon, 04 May 2009 00:00:00 GMT</pubDate>
            <dc:creator>silas</dc:creator>
            <category><![CDATA[Configuration Management]]></category><category><![CDATA[Fedora]]></category><category><![CDATA[Puppet]]></category><category><![CDATA[Ruby]]></category><category><![CDATA[Systems Administration]]></category>
            <guid isPermaLink="true">http://www.silassewell.com/blog/2009/05/04/managing-large-networks-with-puppet/</guid>
            <description><![CDATA[<p><a href="http://projects.puppetlabs.com/projects/puppet" title="Puppet">Puppet</a> is an open source configuration management tool written in
Ruby. It allows a systems administrator to define how a system should be
configured using <a href="http://docs.reductivelabs.com/guides/language_tutorial.html" title="Puppet Language Tutorial">Puppet's</a> <a href="http://en.wikipedia.org/wiki/Declarative_programming" title="Declarative Programming">declarative language</a>. Each Puppet
client pulls its <a href="http://projects.puppetlabs.com/projects/puppet/wiki/Glossary_Of_Terms#catalog" title="Puppet Catalog">catalog</a> at a regular interval and figures out how
to make the catalog definitions true for the local operating system.</p>

<p>The <a href="http://docs.puppetlabs.com/guides/introduction.html" title="Puppet Introduction">Puppet Introduction</a> uses the following diagram to show how
Puppet works.</p>

<p><img src="http://www.silassewell.com/blog/2009/05/04/managing-large-networks-with-puppet/puppet_star.png" alt="Puppet" title="Puppet" /></p>

<p>Currently Puppet is most useful when you have lots of nodes with similar setups. Unfortunately Puppet's declarative language is a bit weak when it comes to inheritance and users familiar with true object oriented systems will soon become frustrated (at least I did). I'm assuming this issue will be addressed in the future, but for now I'm going to tell you how I setup a 100+ node system while adhering to <a href="http://en.wikipedia.org/wiki/Don%27t_repeat_yourself" title="DRY principles">DRY principles</a>.</p>

<p>A quick note, I'm assuming you already know how to use Puppet.</p>

<p>First lets start with the Puppetmaster configuration layout:</p>

<pre><code class="prettyprint">puppet/
 - fileserver.conf
 - manifests/
   - classes/
     - initialize.pp
   - nodes/
     - net/
       - example/
         - web01.pp   # web01.example.net
   - site.pp
   - templates.pp
 - modules/           # application specific modules
   - httpd/
     - files/         # static assets (ex: default HTML file)
     - manifests/     # application configuration logic
     - templates/     # dynamic configuration files (ex: httpd.conf)
</code></pre>

<p><small>The layout was adapted from recommendations in <a href="http://www.amazon.com/Pulling-Strings-Puppet-Configuration-Management/dp/1590599780" title="Pulling Strings with Puppet">Pulling Strings with Puppet</a> by James Turnbull.</small></p>

<p>When I was initially designing my Puppet setup the common practice was to define and initialize the various Puppet types and classes throughout the inheritance tree. So if you had a generic resolv.conf configuration you would include it at the top of the inheritance tree. This worked great until I needed to change one attribute of a class further down. I initially tackled this problem by hacking in if/case statements, but eventually it became unmanageable.</p>

<p>After a couple of rewrites I came up with the idea of wrapping the internals of each class in a conditional statement and initializing all classes at the end of each node.</p>

<p>The key components of my setup were:</p>

<ul>
<li>import all modules in the site.pp manifest</li>
<li>wrap the code of each class in a conditional statement</li>
<li>define and extend attributes throughout the inheritance tree (including the class conditional)</li>
<li>include all classes at the end of each node</li>
</ul>

<p>This lets you both arbitrarily redefine or extend class attributes (including the on/off state) throughout the inheritance tree.</p>

<p>I've created a <a href="http://silassewell.googlecode.com/svn/trunk/2009/05/03/puppet/" title="Simple Example">simple example</a> to show how this setup works. The main files are listed below (you'll want to go through each in order):</p>

<ul>
<li><a href="http://www.silassewell.com/blog/2009/05/04/managing-large-networks-with-puppet/site.pp" title="site.pp">site.pp</a> - import modules</li>
<li><a href="http://www.silassewell.com/blog/2009/05/04/managing-large-networks-with-puppet/templates.pp" title="template.pp">templates.pp</a> - define and extend class attributes</li>
<li><a href="http://www.silassewell.com/blog/2009/05/04/managing-large-networks-with-puppet/web01.pp" title="web01.pp">web01.pp</a> - make use of defaults</li>
<li><a href="http://www.silassewell.com/blog/2009/05/04/managing-large-networks-with-puppet/ns01.pp" title="ns01.pp">ns01.pp</a> - disable a class</li>
<li><a href="http://www.silassewell.com/blog/2009/05/04/managing-large-networks-with-puppet/initialize.pp" title="initialize.pp">initialize.pp</a> - initialize all classes</li>
<li><a href="http://www.silassewell.com/blog/2009/05/04/managing-large-networks-with-puppet/client.pp" title="client.pp">client.pp</a> - class implementation</li>
</ul>

<p>Also note that I designed this setup about 8 months ago and I haven't kept as up-to-date on recent developments as I should. If there is a better way to do this please let me know.</p>]]></description>
        </item>

        <item>
            <title>Persistent Queuing in Python</title>
            <link>http://www.silassewell.com/blog/2008/09/26/persistent-queuing-python/</link>
            <pubDate>Fri, 26 Sep 2008 00:00:00 GMT</pubDate>
            <dc:creator>silas</dc:creator>
            <category><![CDATA[Programming]]></category><category><![CDATA[Python]]></category><category><![CDATA[Ruby]]></category>
            <guid isPermaLink="true">http://www.silassewell.com/blog/2008/09/26/persistent-queuing-python/</guid>
            <description><![CDATA[
<p><a href="http://code.google.com/p/peafowl/">Peafowl</a> is a Python port of Ruby's <a href="http://rubyforge.org/projects/starling/">Starling</a>.</p>
]]></description>
        </item>

    </channel>
</rss>
