<?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>The Otter Book</title>
	<atom:link href="http://www.otterbook.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.otterbook.com</link>
	<description>Automating System Administration with Perl</description>
	<lastBuildDate>Wed, 13 Jun 2012 13:43:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Puppet Puzzle, Solved?</title>
		<link>http://www.otterbook.com/blog/2011/06/puppet-puzzle-solved/</link>
		<comments>http://www.otterbook.com/blog/2011/06/puppet-puzzle-solved/#comments</comments>
		<pubDate>Sun, 05 Jun 2011 17:44:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[configuration management]]></category>
		<category><![CDATA[puppet]]></category>
		<category><![CDATA[workflow]]></category>

		<guid isPermaLink="false">http://www.otterbook.com/?p=503</guid>
		<description><![CDATA[Like Diogenes1 I&#8217;ve been wandering around from Puppet user to Puppet user asking about the questions I brought up in the first post in this series. It seemed like such a sub-optimal hole in the workflow for the standard use case, I couldn&#8217;t believe others weren&#8217;t seeing and addressing it with some best practice I hadn&#8217;t [...]]]></description>
				<content:encoded><![CDATA[<p></p><p>Like Diogenes<sup><a href="http://www.otterbook.com/blog/2011/06/puppet-puzzle-solved/#footnote_0_503" id="identifier_0_503" class="footnote-link footnote-identifier-link" title="though I&rsquo;d like to think a little nicer. He seemed like quite a character.">1</a></sup> I&#8217;ve been wandering around from Puppet user to Puppet user asking about the questions I brought up in the <a title="A Puppet Puzzle" href="http://www.otterbook.com/blog/2011/05/puppet-puzzle/">first post in this series</a>. It seemed like such a sub-optimal hole in the workflow for the standard use case, I couldn&#8217;t believe others weren&#8217;t seeing and addressing it with some best practice I hadn&#8217;t heard about yet.</p>
<p>One of the people who was kind enough to suffer my investigation was was Eric Shamow, Manager of the System Operations Group at Advance Internet. He even tolerated this during the Q&amp;A for his excellent talk at the <a href="http://www.picconf.org">PICC 2011 conference</a>.  Eric introduced me to Nigel Kersten at Puppet Labs who graciously agreed to participate in the discussion about workflow Eric and I were having.</p>
<p>One of the things that came out of that discussion<sup><a href="http://www.otterbook.com/blog/2011/06/puppet-puzzle-solved/#footnote_1_503" id="identifier_1_503" class="footnote-link footnote-identifier-link" title="and it is possible I&rsquo;ll post more here from it in future episodes">2</a></sup> was an idea that came the closest to any I&#8217;ve heard for addressing my workflow concerns. I&#8217;d like to tell you about it now by paraphrasing what Nigel suggested in my own words. Any errors in the following are mine, any cool ideas found there should be attributed to Nigel.</p>
<p>For this explanation, I&#8217;m going to bring back some of the stellar diagram artwork from the first post in the series. My artistic skills haven&#8217;t really improved since that post, so apologies in advance.</p>
<h2>The Big Idea</h2>
<p>Let&#8217;s review the cast of characters from our first post:</p>
<p><span id="more-503"></span></p>
<p><a href="http://www.otterbook.com/wp-content/uploads/2011/06/cast.jpg"><img class="aligncenter size-full wp-image-505" title="cast" src="http://www.otterbook.com/wp-content/uploads/2011/06/cast.jpg" alt="" width="400" height="298" /></a>We have a web server whose configuration is managed by Puppet. The files seen and served by the Puppet server are all kept in a version control system of some sort.</p>
<p>Now let me introduce you to the new members that makes this all work:</p>
<p><a href="http://www.otterbook.com/wp-content/uploads/2011/06/perpuppet.jpg"><img class="aligncenter size-full wp-image-506" title="perpuppet" src="http://www.otterbook.com/wp-content/uploads/2011/06/perpuppet.jpg" alt="" width="444" height="158" /></a></p>
<p>Nigel calls these &#8220;development Puppet servers&#8221; but I&#8217;m more partial to the name &#8220;personal Puppet servers.&#8221; because I think it makes the concept even clearer. Here&#8217;s the idea:</p>
<p>Everyone on the team gets their own personal Puppet server. When a team member wants to work on the web server&#8217;s configuration, she:</p>
<ol>
<li>makes a clone of the main Puppet server&#8217;s node configuration (e.g. its /etc/puppet/modules directory).</li>
<li>re-homes the Puppet client on the web server to point to her personal Puppet server.</li>
<li>works on the web server&#8217;s configuration as it is kept on her personal Puppet server, changing it, pushing it to the web server and testing it until it is just the way she wants it.</li>
<li>pushes the changes she made on her personal Puppet server to the main Puppet server<sup><a href="http://www.otterbook.com/blog/2011/06/puppet-puzzle-solved/#footnote_2_503" id="identifier_2_503" class="footnote-link footnote-identifier-link" title="or more precisely, to the VCS system that feeds the main Puppet server">3</a></sup>.</li>
<li>re-homes the web server&#8217;s Puppet client back to the main Puppet server.</li>
</ol>
<p>Let&#8217;s see this process in pictures before we look at this solution in more detail:</p>
<p><a href="http://www.otterbook.com/wp-content/uploads/2011/06/clrehome.jpg"><img class="aligncenter size-full wp-image-507" title="clrehome" src="http://www.otterbook.com/wp-content/uploads/2011/06/clrehome.jpg" alt="" width="398" height="277" /></a></p>
<p>First we clone the configuration information from the main Puppet server to our personal Puppet server. Then we tell the Puppet client on the web server to look to our Puppet server instead of the &#8220;real&#8221; one for its configuration.</p>
<p>[Now pretend I've inserted a picture here of a sysadmin/devop furiously editing the web server config on a personal Puppet server, pulling it from that server to the web server, reloading the config on the web server, and repeating until happy with the changes.]</p>
<p>Finally, we merge our changes back to the main VCS repository, re-home the web server back to the &#8220;real&#8221; Puppet server, and everything is copacetic:</p>
<p><a href="http://www.otterbook.com/wp-content/uploads/2011/06/rehome.jpg"><img class="aligncenter size-full wp-image-508" title="rehome" src="http://www.otterbook.com/wp-content/uploads/2011/06/rehome.jpg" alt="" width="423" height="322" /></a></p>
<h2>Pros and Cons</h2>
<p>So what do I like so much about this solution?</p>
<ol>
<li>Once you&#8217;ve re-homed to your personal Puppet server, you can change, push, and test your new config in a very tight, fast, and lightweight loop. Given this addresses my major concern, this solution is already a win with the rest being gravy.</li>
<li>That loop uses the same process to generate and distribute configs as the &#8220;normal&#8221; Puppet process. If your main Puppet server&#8217;s config does a bunch of fancy templatey, databasey, Ruby mangley<sup><a href="http://www.otterbook.com/blog/2011/06/puppet-puzzle-solved/#footnote_3_503" id="identifier_3_503" class="footnote-link footnote-identifier-link" title="ok, I will stop now">4</a></sup> things to produce the final web server configuration, they will all be present and tested during the &#8220;editing/development&#8221; process. This means you are much less likely to have to debug the Puppet part of the config after it gets to the real Puppet server<sup><a href="http://www.otterbook.com/blog/2011/06/puppet-puzzle-solved/#footnote_4_503" id="identifier_4_503" class="footnote-link footnote-identifier-link" title="I realize there is a bit of handwaving here, more on that in the cons section">5</a></sup>.</li>
<li>The editing loop can be customized to the person who is doing the changing. If they want to be highly fastidious in their use of a VCS  locally on their personal Puppet server,  topic-branching, merging and rebasing like a madman,  great. If they want to skip that and just change files willy-nilly, fine. Both types of people will have to &#8220;do the right thing&#8221; when they merge their changes to the main VCS repository.</li>
<li>There is no longer a need to have a &#8220;personal&#8221; environment<sup><a href="http://www.otterbook.com/blog/2011/06/puppet-puzzle-solved/#footnote_5_503" id="identifier_5_503" class="footnote-link footnote-identifier-link" title="in the Puppet sense of the word. This is essentially a person&rsquo;s own directory tree within the /etc/puppet module directory">6</a></sup>. Instead of switching in and out of <em>/etc/puppet/mypersonalenvironment/modules</em> (and keeping that in sync with the target directory), all of the team members can make their changes in their target environment (<em>/etc/puppet/modules</em>, or <em>/etc/puppet/development/modules</em>, etc.) on their local machine. This is one less context shift during the process and one less thing each person has to keep alive in their head<sup><a href="http://www.otterbook.com/blog/2011/06/puppet-puzzle-solved/#footnote_6_503" id="identifier_6_503" class="footnote-link footnote-identifier-link" title="and hey, if you like using a ton of personal environments, there is nothing about this solution that precludes you from doing so">7</a></sup>.</li>
</ol>
<p>What&#8217;s not to love about this idea?</p>
<ol>
<li>More moving parts. You have to be able to stand up more Puppet servers easily (though Nigel points out that standing up a Puppet server for just a few nodes, providing all of the Puppet dependencies are installed, is just a matter of typing:<br />
<em>puppet master &#8211;verbose &#8211;no-daemonize &#8211;&lt;other settings&gt;</em> ).</li>
<li>Your main Puppet infrastructure and configs have to be engineered with portability in mind. I was hand-waving when I said the personal Puppet server would behave in the exact same way as the production master. That&#8217;s only true if you haven&#8217;t created a configuration that isn&#8217;t tightly tied to a specific machine (e.g. the database backend only accepts connections from <em>localhost</em>). If a clone of the configs would break on any every machine besides the master, that&#8217;s a problem.</li>
<li>The other place I put on a pair of rose colored glasses was when I asserted that you would not have to debug the Puppet config when it got the real server. There are lots of issues that could crop up when a config is deployed at scale that you wouldn&#8217;t necessarily see with one Puppet client or working on a single web server. You may make a change that ripples out to more machines than you anticipate<sup><a href="http://www.otterbook.com/blog/2011/06/puppet-puzzle-solved/#footnote_7_503" id="identifier_7_503" class="footnote-link footnote-identifier-link" title="Luke&rsquo;s talk here suggests they are working on or are going to work on better tools to let you understand the scope of Puppet config changes.">8</a></sup> I think this proposed setup helps eliminate one tier of potential failures, but there&#8217;s always another one above it.</li>
<li>This idea doesn&#8217;t necessarily remove the VCS-related complexities I whined about in <a title="The Puppet Puzzle Becomes More Perspicuous" href="http://www.otterbook.com/blog/2011/05/puppet-puzzle-2/">my last post</a>. Merging, branches, etc, all may still be a fun ball of wax. Similarly, there&#8217;s no real protection between two people making mutually incompatible changes to different parts of the web server. Not really news, but I thought I should cop to it anyway.</li>
<li>There&#8217;s a definite lack of granularity here. Once I re-home a machine to my personal Puppet server, the entire machine stops getting configuration updates from anyone but me. If I&#8217;m cool and refresh my Puppet server&#8217;s clone periodically, that helps some, but we&#8217;re still fundamentally dealing with things on a per-machine level. It would be nice to be able to re-home just a portion of a machine&#8217;s configuration. I&#8217;ve never heard of a Puppet client receiving information from more than one Puppet server, but I bet you could fake it. One possible but potentially icky method would be to go back to something similar to the ideas in the Pro Puppet book. You could construct a directory tree from the amalgamation of several different VCS repositories. My assertion is it would be better to build this functionality into the Puppet layer vs. trying to cobble together something using a VCS tool.</li>
<li>There are potentially some security questions around SSL certificates. See the details section below.</li>
<li>Someone might forget and (or intentionally) leave the web server re-homed to the wrong place. Ideally you would have monitoring in place to scream should this happen.</li>
</ol>
<h2>Details, Details</h2>
<p>There are a number of implementation details, some obvious, some a little more hidden that need to be solved to put a scheme like the one I&#8217;ve described together. For example, Puppet&#8217;s SSL/Certificate authority stuff is going to have to come into play. In the initial setup with only a single Puppet production master, all of the clients have presumably already been authorized to use that server. That&#8217;s the whole <em>puppetca -s</em> stuff we go through to have the client&#8217;s certificates signed for the server. You have to handle a similar situation for each  personal Puppet server<sup><a href="http://www.otterbook.com/blog/2011/06/puppet-puzzle-solved/#footnote_8_503" id="identifier_8_503" class="footnote-link footnote-identifier-link" title="maybe you can make it easier on yourself by using autosign, caveat implementor, or pre-generating certs. I haven&rsquo;t thought more about this but I wonder if you could perform some slight-of-hand using interface aliases/CNAMES">9</a></sup>.</p>
<p>There are other questions, like where do you host the personal Puppet servers (on an individual workstation?, a new VM you spin up for a person in a central farm?, perhaps on your laptop using <a href="http://vagrantup.com/">Vagrant</a>, etc.?), how do make sure you have the necessary bits on disk for Puppet to run?<sup><a href="http://www.otterbook.com/blog/2011/06/puppet-puzzle-solved/#footnote_9_503" id="identifier_9_503" class="footnote-link footnote-identifier-link" title="the Pro Puppet book suggests you can manage Puppet with Puppet which sounds peachy to me">10</a></sup>, are the firewall rules ok? (which machines are allowed to talk to which Puppet servers) and so on. I&#8217;m sure you can think of more.</p>
<h2>And Now Ladies and Gentlemen, The Future</h2>
<p>There are three sets of futures to discuss:</p>
<ol>
<li><em>My future</em> &#8212; we&#8217;re going to try using this setup on our initial deploy at $WORK unless we hit some showstopper on the way. I can try and report back on our experiences if anyone would find that valuable.</li>
<li><em>Puppet&#8217;s future</em> &#8212; discussing this in greater depth with Nigel and Eric, it seems like there is a healthy eagerness on the part of Puppet Labs and the rest of the community to wrestle with problems like these. I&#8217;ve used the word &#8220;workflow&#8221; throughout these posts, but I&#8217;m painfully aware that I have just touched the very surface of the topic. I believe the tool has the potential to evolve to make some of the sorts of stuff I&#8217;ve discussed here easier to pull off<sup><a href="http://www.otterbook.com/blog/2011/06/puppet-puzzle-solved/#footnote_10_503" id="identifier_10_503" class="footnote-link footnote-identifier-link" title="I like it when a tool makes it easy to &ldquo;do the right thing,&rdquo; i.e. follow best practices.">11</a></sup>. And further workflow-related additions are on the way.</li>
<li><em>Our future together</em> &#8212; I realize that these three blog posts might have an &#8220;asked, then answered&#8221; story arc, but I think the questions around how you use a configuration management tool like Puppet within a larger context  are far from being exhausted. I hope you&#8217;ll comment here or keep bringing questions like this to the mailing lists for those tools. Please tell me how you are addressing these sort of issues.</li>
</ol>
<ol class="footnotes"><li id="footnote_0_503" class="footnote">though I&#8217;d like to think a little nicer. He seemed like <a href="http://en.wikipedia.org/wiki/Diogenes_of_Sinope">quite a character</a>.</li><li id="footnote_1_503" class="footnote">and it is possible I&#8217;ll post more here from it in future episodes</li><li id="footnote_2_503" class="footnote">or more precisely, to the VCS system that feeds the main Puppet server</li><li id="footnote_3_503" class="footnote">ok, I will stop now</li><li id="footnote_4_503" class="footnote">I realize there is a bit of handwaving here, more on that in the cons section</li><li id="footnote_5_503" class="footnote">in the Puppet sense of the word. This is essentially a person&#8217;s own directory tree within the /etc/puppet module directory</li><li id="footnote_6_503" class="footnote">and hey, if you like using a ton of personal environments, there is nothing about this solution that precludes you from doing so</li><li id="footnote_7_503" class="footnote">Luke&#8217;s talk <a href="http://vimeo.com/23346640">here</a> suggests they are working on or are going to work on better tools to let you understand the scope of Puppet config changes.</li><li id="footnote_8_503" class="footnote">maybe you can make it easier on yourself by using autosign, caveat implementor, or pre-generating certs. I haven&#8217;t thought more about this but I wonder if you could perform some slight-of-hand using interface aliases/CNAMES</li><li id="footnote_9_503" class="footnote">the Pro Puppet book suggests you can manage Puppet with Puppet which sounds peachy to me</li><li id="footnote_10_503" class="footnote">I like it when a tool makes it easy to &#8220;do the right thing,&#8221; i.e. follow best practices.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.otterbook.com/blog/2011/06/puppet-puzzle-solved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Puppet Puzzle Becomes More Perspicuous</title>
		<link>http://www.otterbook.com/blog/2011/05/puppet-puzzle-2/</link>
		<comments>http://www.otterbook.com/blog/2011/05/puppet-puzzle-2/#comments</comments>
		<pubDate>Fri, 27 May 2011 06:07:26 +0000</pubDate>
		<dc:creator>dnb</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[configuration management]]></category>
		<category><![CDATA[puppet]]></category>
		<category><![CDATA[workflow]]></category>

		<guid isPermaLink="false">http://www.otterbook.com/?p=468</guid>
		<description><![CDATA[Even though my exploration into the questions I broached in my last post didn&#8217;t actually continue with what you will find in this post, I&#8217;m going to pretend it did because it makes for a better narrative. Please bear with me. I&#8217;ve been working my way through the very new and excellent book Pro Puppet [...]]]></description>
				<content:encoded><![CDATA[<p><a class="post_image_link" href="http://www.otterbook.com/blog/2011/05/puppet-puzzle-2/" title="Permanent link to The Puppet Puzzle Becomes More Perspicuous"><img class="post_image alignright frame" src="http://www.otterbook.com/wp-content/uploads/2011/05/propuppetthumb.png" width="122" height="161" alt="Post image for The Puppet Puzzle Becomes More Perspicuous" /></a>
</p><p>Even though my exploration into the questions I broached in <a title="A Puppet Puzzle" href="http://www.otterbook.com/blog/2011/05/puppet-puzzle/">my last post</a> didn&#8217;t actually continue with what you will find in this post, I&#8217;m going to pretend it did because it makes for a better narrative. Please bear with me.</p>
<p>I&#8217;ve been working my way through the very new and excellent book <a href="http://www.amazon.com/Pro-Puppet-James-Turnbull/dp/1430230576">Pro Puppet</a> by James Turnbull and Jeffrey McCune. Given my last set of questions, I was excited to hit the third chapter in the book which is all about workflow, how Puppet gets used with a VCS (git) and all that good stuff. And then I started to read&#8230;</p>
<p><span id="more-468"></span><div id='stb-box-6164' class='stb-warning_box' >Let me say right up front that this is (so far) an excellent book. I am enjoying it thoroughly. So good that I&#8217;m linking to Amazon and showing a picture of the cover so I can help their book sales. It has a ton of stuff in it at exactly the right level for the sophisticated user who wants to engage with Puppet.</p>
<p>I need to say this because in just a moment I&#8217;m going to be quoting from the book in an apparently critical fashion. This is because I want to level some criticism at the <em>tools</em> it describes and how we are being compelled to use them by the lack of a better alternative, not the book or the authors&#8217; work. I have no doubt Turnbull and McCune are describing the state of the art. I just desperately want the state of the art to suck less.</div></p>
<p>Chapter three tells the tale of a standard infrastructure (mail, web, DB servers) managed using separate development, test and production environments&#8211;all of this handled by a single Puppet install. And in this happy little world we have three team members: the system administrator<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle-2/#footnote_0_468" id="identifier_0_468" class="footnote-link footnote-identifier-link" title="who is talked about using a female pronoun, kudos to the authors!">1</a></sup>, the developer and an operator who are all attempting to play nice<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle-2/#footnote_1_468" id="identifier_1_468" class="footnote-link footnote-identifier-link" title="as opposed to some the potential Lord of the Flies scenarios">2</a></sup>.  Sounds pretty much like your workplace, right?</p>
<p>Ok, so let me see if I can summarize just how the authors propose this all should work. First the prep work:</p>
<ol>
<li>Within the /etc/puppet directory, we have a modules directory for the production environment configs. This directory is made into a git repository<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle-2/#footnote_2_468" id="identifier_2_468" class="footnote-link footnote-identifier-link" title="Count along with me boys and girls as we create a number of git-controlled directories/repositories in our journey. This will be number one.">3</a></sup>.</li>
<li>We clone that repository into (newly made) /etc/puppet/environments/development and /etc/puppet/environments/testing directories<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle-2/#footnote_3_468" id="identifier_3_468" class="footnote-link footnote-identifier-link" title="That would be git repos 2 and 3.">4</a></sup>. They will be used for the dev and testing environments respectively. Git &#8220;remote&#8221; references are then added between the repositories to make it easier to move things between them as necessary.</li>
<li> Next we create a new &#8220;bare&#8221; central repository<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle-2/#footnote_4_468" id="identifier_4_468" class="footnote-link footnote-identifier-link" title="Yup, #4.">5</a></sup> that will be used as a rendezvous point for the three team members to exchange changes between themselves and with the Puppet server config directory (which will now be checked out from this central repository).</li>
<li>Each of the team members is expected to check out a working copy of the central repository<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle-2/#footnote_5_468" id="identifier_5_468" class="footnote-link footnote-identifier-link" title="One copy each, but we will just follow one ball at time so call this git area #5.">6</a></sup> into their home directory, then&#8230;</li>
</ol>
<p>Now the actual work to make an edit, each person will:</p>
<ol>
<li>create a branch in their working copy within which they will make their edits.</li>
<li>make the change to a file in that working copy</li>
<li>commit that change<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle-2/#footnote_6_468" id="identifier_6_468" class="footnote-link footnote-identifier-link" title="since we are in git-land, the git commit command is perhaps better described as &ldquo;staging&rdquo; the change.">7</a></sup></li>
<li>push that staged commit with the new branch in it up to the central repository</li>
<li>on the Puppet server itself, logged in as the <em>puppet</em> user, in the right config directory, use git to check out the the right branch from the central repository into that directory<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle-2/#footnote_7_468" id="identifier_7_468" class="footnote-link footnote-identifier-link" title="yes, you heard that all correctly, hope you got it all right">8</a></sup>. This check out operation will switch that directory to the branch.</li>
<li>run the puppet agent command (maybe in &#8211;noop mode to make sure the change really makes sense)</li>
</ol>
<p>Doesn&#8217;t that sound like fun? Does the following quote from the book make it sound any more fun?</p>
<p>(speaking of a second team member repeating the process we just described with his own change&#8230;)</p>
<blockquote><p>This process will switch the current development environment away from whatever branch it was previously on. This could potentially interfere with the work of {the first team member}. If this becomes a common problem, it is possible to set up more environments to ensure each contributor has their own location to test their changes without interfering with others.</p></blockquote>
<p>So we are at 5 separate git controlled spaces, each with its own state (branch, remote references, etc.) and we&#8217;re still bound to bump into our colleagues. On top of that we&#8217;ve got a lovely multi-step process after a change is made that the book more succinctly elsewhere describes as:</p>
<blockquote><p>The overall workflow {the second team member} follows is to push their topic branch to the central repository, fetch the changes in the development environment&#8217;s repository, check out the topic branch, then run the Puppet agent against the development environment.</p></blockquote>
<p>I can&#8217;t tell whether to be dismayed more by the number of steps, the possibility for human error , the sheer quantity of git commands, the need to have everyone run something manually on the server as a separate shared user or what. At the very least it appears each person has to keep lots of different sets of context (what branch, what environment, what remote repos, what change, what is it going to effect, and so on) in their head for each change to the environment.</p>
<p>Now, I&#8217;m sure that some of this can be ameliorated by writing a number of shell scripts<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle-2/#footnote_8_468" id="identifier_8_468" class="footnote-link footnote-identifier-link" title="I don&rsquo;t begrudge the authors for not demonstrating that; as an author myself I understand how it sometimes doesn&rsquo;t make sense to add another layer to an already complex explanation.">9</a></sup>, but boy does it give me the heebie jeebies. I know it certainly doesn&#8217;t make me feel any better about the questions I raised in the <a title="A Puppet Puzzle" href="http://www.otterbook.com/blog/2011/05/puppet-puzzle/">my last post</a>.</p>
<p>Summary: love the book, dislike this particular solution in it.</p>
<p>Luckily, I did find <a title="Puppet Puzzle, Solved?" href="http://www.otterbook.com/blog/2011/06/puppet-puzzle-solved/">a better answer</a>&#8230;</p>
<ol class="footnotes"><li id="footnote_0_468" class="footnote">who is talked about using a female pronoun, kudos to the authors!</li><li id="footnote_1_468" class="footnote">as opposed to some the potential Lord of the Flies scenarios</li><li id="footnote_2_468" class="footnote">Count along with me boys and girls as we create a number of git-controlled directories/repositories in our journey. This will be number one.</li><li id="footnote_3_468" class="footnote">That would be git repos 2 and 3.</li><li id="footnote_4_468" class="footnote">Yup, #4.</li><li id="footnote_5_468" class="footnote">One copy each, but we will just follow one ball at time so call this git area #5.</li><li id="footnote_6_468" class="footnote">since we are in git-land, the git commit command is perhaps better described as &#8220;staging&#8221; the change.</li><li id="footnote_7_468" class="footnote">yes, you heard that all correctly, hope you got it all right</li><li id="footnote_8_468" class="footnote">I don&#8217;t begrudge the authors for not demonstrating that; as an author myself I understand how it sometimes doesn&#8217;t make sense to add another layer to an already complex explanation.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.otterbook.com/blog/2011/05/puppet-puzzle-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Puppet Puzzle</title>
		<link>http://www.otterbook.com/blog/2011/05/puppet-puzzle/</link>
		<comments>http://www.otterbook.com/blog/2011/05/puppet-puzzle/#comments</comments>
		<pubDate>Wed, 11 May 2011 13:17:06 +0000</pubDate>
		<dc:creator>dnb</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[configuration management]]></category>
		<category><![CDATA[puppet]]></category>
		<category><![CDATA[workflow]]></category>

		<guid isPermaLink="false">http://www.otterbook.com/?p=402</guid>
		<description><![CDATA[I&#8217;ve watched the birth and toddlerhood of all of the major configuration management tools (Puppet, Cfengine, Chef, Bcfg2, and so on) and have had the pleasure of knowing and interacting with almost all of their parents over the years. Recently I decided it was high time I get my hands dirty by leading a substantial [...]]]></description>
				<content:encoded><![CDATA[<p></p><p>I&#8217;ve watched the birth and toddlerhood of all of the major configuration management tools (<a href="http://www.puppetlabs.com/" target="_blank">Puppet</a>, <a href="http://www.cfengine.org/" target="_blank">Cfengine</a>, <a href="http://www.opscode.com/" target="_blank">Chef</a>, <a href="http://trac.mcs.anl.gov/projects/bcfg2" target="_blank">Bcfg2</a>, and so on) and have had the pleasure of knowing and interacting with almost all of their parents over the years. Recently I decided it was high time I get my hands dirty by leading a substantial deployment of one of the tools at $WORK. The first tool I thought I would tackle would be Puppet.</p>
<p>In the process of planning for this effort, I&#8217;ve identified what appears to be a fairly large usability/workflow gap in Puppet<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle/#footnote_0_402" id="identifier_0_402" class="footnote-link footnote-identifier-link" title="and most other config mgmt tools, so even if you use another config mgmt system, I&rsquo;d still love your input">1</a></sup>. I&#8217;ve tried to talk to a whole bunch of people about how they do things, but as far as I can tell everyone is still making due with fairly rickety rope bridges to get over the gap. It is entirely possible I&#8217;ve overlooked something obvious or the problem isn&#8217;t as big as the amount of scrutiny I&#8217;ve given it. But something in my long-time sysadmin heart tells me we could be doing much better. I&#8217;d like to see if I can pose a clear and cogent problem statement here and see if others can help me figure out what I&#8217;m missing.</p>
<h1>What&#8217;s the Problem?</h1>
<p>One of the most common scenarios for how Puppet is used seems (to me) to have a &#8220;best practices&#8221; workflow that is unclear at best and unwieldy at worst. Given how often a sysadmin performs this workflow, I&#8217;d really like to know if there is a better way. If there isn&#8217;t, I&#8217;d like to work with people to invent one. Please read on for the gory details&#8230;</p>
<p><span id="more-402"></span></p>
<h1>The Setup</h1>
<p>Let&#8217;s see the players in a super simple setup that I think provides a good demonstration of my quandary. Let&#8217;s say we have a web server host of some sort<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle/#footnote_1_402" id="identifier_1_402" class="footnote-link footnote-identifier-link" title="for the purpose of this discussion, it does not matter whether or not this web server is considered production or dev, though if it is the former this question becomes a bit more interesting.">2</a></sup> called <em>www</em> configured through a <em>httpd.conf</em> file:</p>
<p style="text-align: center;"><a href="http://www.otterbook.com/wp-content/uploads/2011/05/www-server.jpg"><img class="size-full wp-image-430 aligncenter" title="www-server" src="http://www.otterbook.com/wp-content/uploads/2011/05/www-server.jpg" alt="" width="201" height="158" /></a></p>
<p>We&#8217;ll want this configuration file to be managed by Puppet, so let&#8217;s bring in a central Puppet server called <em>puppetmaster</em>.  This server will store a copy of httpd.conf in its local datastore to be served out to Puppet clients:</p>
<p style="text-align: center;"><a href="http://www.otterbook.com/wp-content/uploads/2011/05/puppet.jpg"><img class="aligncenter size-full wp-image-432" title="puppet" src="http://www.otterbook.com/wp-content/uploads/2011/05/puppet.jpg" alt="" width="500" height="183" /></a></p>
<p>We&#8217;ll assume that there is a Puppet client running on <em>www</em>. It is configured in the default manner to wake up every N minutes<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle/#footnote_2_402" id="identifier_2_402" class="footnote-link footnote-identifier-link" title="or the Puppet client is run every N minutes from cron">3</a></sup> and ask the server for changes to its config, pull down them down, and implement them. If a change is made locally on <em>www</em>, but the change is not propagated to the Puppet-managed config, it will be overwritten.</p>
<p>It is a best practice for a number of reasons for users to never directly edit the file that the Puppet server sees on disk. Instead, we&#8217;ll want the Puppet server to work from a copy of the file that is stored in some version control system. Indeed, even <a href="http://docs.puppetlabs.com/guides/introduction.html" target="_blank">Introduction to Puppet</a> on the official website shows this picture:</p>
<p><img src="http://docs.puppetlabs.com/images/Puppet_Star.png" alt="" /></p>
<p>with nary a comment about the SVN box, probably because the value of using a VCS is well accepted. I&#8217;ll add a similar version control host to my example. The version control system could actually reside on the same host as any of the other components we&#8217;ve described but I&#8217;m going to break it out for simplicity (and best practices) sake. Let&#8217;s call it <em>vcs</em> and add it to the diagram we&#8217;ve been building:</p>
<p style="text-align: center;"><a href="http://www.otterbook.com/wp-content/uploads/2011/05/vcs.jpg"><img class="aligncenter size-full wp-image-434" title="vcs" src="http://www.otterbook.com/wp-content/uploads/2011/05/vcs.jpg" alt="" width="481" height="361" /></a></p>
<p>As far as I can tell, there&#8217;s nothing new or remotely special about the setup I&#8217;ve described. Now let&#8217;s start to build the puzzle.</p>
<h1>Question 1: Where Should You Edit the Web Server&#8217;s Config File?</h1>
<p>Ok, it&#8217;s showtime! Let&#8217;s change the web server&#8217;s running configuration. For yuks, let&#8217;s assume this will be a substantial multi-line change and it is one I&#8217;m doing by hand<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle/#footnote_3_402" id="identifier_3_402" class="footnote-link footnote-identifier-link" title="vs. some automated generation of that configuration">4</a></sup>. Changes like this are often iterative, meaning I make a change, test it, fix any problems, test, fix more, and so on.</p>
<p>So where do I do this &#8220;iterative development&#8221; of the config? Here are two choices:</p>
<ol>
<li><em>Right there on the web server, in situ where the config file lives.</em><br />
First we stop Puppet (don&#8217;t want our changes overwritten by the regular update cycle!<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle/#footnote_4_402" id="identifier_4_402" class="footnote-link footnote-identifier-link" title=" we could play beat the clock, but that seems treacherous. It causes people to have to pay attention to an unnecessary time limit. If they get up to pee, they risk &nbsp;having to revert their changes from the backup copy Puppet leaves behind.">5</a></sup> ), then we edit. Once we are done editing, we then have to get the changed file into our version control repository and then from there into the Puppet repository<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle/#footnote_5_402" id="identifier_5_402" class="footnote-link footnote-identifier-link" title="as an aside, bcfg2 handles this situation really nicely. It knows how to specify that the changed copy on local disk should now be considered the true version and to suck that change back into the bcfg2 configuration with a minimal amount of effort.">6</a></sup>. At that point we can restart Puppet<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle/#footnote_6_402" id="identifier_6_402" class="footnote-link footnote-identifier-link" title="you did remember to restart it, right?">7</a></sup>.</li>
<li><em>In some working directory, someplace (doesn&#8217;t matter where), that is &#8220;checked out/cloned&#8221; for editing from the version control system.</em><br />
Each time I want to test a change, I have to commit the changes back to the VCS and either wait for it to propagate back to the web server or somehow &#8220;push&#8221; the process to make it happen sooner than the usual interval. Once it gets to the server, either Puppet  or I have to tell the server to reload its config. I can then test if this change was correct. If not, edit the local copy, commit it again. Rinse and repeat.</li>
</ol>
<p>Let&#8217;s examine the pros and cons of each of these options.</p>
<h2>The<em> In Situ </em>Option</h2>
<p>For the <em>in situ</em> option, the development process has a little less friction. Make a change, tell the web server to load the config. Test. Make another change, reload. It works. Check changes back into VCS so the correct version will be managed via Puppet when you&#8217;ve got a version of the config you like. Here&#8217;s a diagram of this option:</p>
<p><a href="http://www.otterbook.com/wp-content/uploads/2011/05/insitu.jpg"><img class="aligncenter size-full wp-image-439" title="insitu" src="http://www.otterbook.com/wp-content/uploads/2011/05/insitu.jpg" alt="" width="489" height="386" /></a></p>
<p>The places you get into trouble with this option are:<br />
a) remembering to put the config back into Puppet<br />
b) making sure puppet doesn&#8217;t stomp on the work you are doing while you are doing it<br />
c) you&#8217;ve introduced a change in the &#8220;control flow&#8221; path that the web server config file took to get to the machine. Because we edited it in place, that change didn&#8217;t get to the machine via Puppet. As a result it bypassed any of the processing Puppet might have done to select/produce that file (e.g. templating).</p>
<p>Each of these trouble areas has its own peril:</p>
<ul>
<li>Humans are fallible, so for a) you run the risk of version skew if you forgot to check your changes back in<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle/#footnote_7_402" id="identifier_7_402" class="footnote-link footnote-identifier-link" title="yes, you can and probably should run some sort of Puppet dry-run report that would tell you if you blew it, but why set up a situation that is bound to fail due to human error?">8</a></sup>.</li>
<li>Having to stop Puppet on a machine has the obvious side effects if it is not restarted. But what about the case where your colleague has changed another file in Puppet which isn&#8217;t getting to that machine because you disabled Puppet there?</li>
<li>Having a config file get to a machine in two different ways is bound to force you to eventually debug an issue with &#8220;the road less traveled,&#8221; I&#8217;ll lay money on the table that at some point you&#8217;ll find yourself  puzzling over why a Puppet-sourced change to a file didn&#8217;t do something you expected.</li>
</ul>
<h2>The Version Control System Option</h2>
<p>Now let&#8217;s look at the other option where we make all of our changes in some working copy and then push them to the VCS and then push them into Puppet so Puppet can get them on to the client. I intentionally used a run-on sentence to demonstrate the multi-step complexity of this option. I call this the &#8220;spin the wheel&#8221; option because you essentially have to spin the entire giant wheel to get each (even trivial) change to boomerang back to you and be put in place on the web server:</p>
<p style="text-align: center;"><a href="http://www.otterbook.com/wp-content/uploads/2011/05/vcschange.jpg"><img class="aligncenter size-full wp-image-443" title="vcschange" src="http://www.otterbook.com/wp-content/uploads/2011/05/vcschange.jpg" alt="" width="490" height="450" /></a></p>
<p>To go this route, you need to have a method to quickly:</p>
<ol>
<li>get the VCS version of the file into the Puppet datastore (more on this in a moment) and</li>
<li>get the Puppet client&#8217;s config pull to take place out of its normal sequence (not hard for a single machine, but it does need to only happen after #1 has successfully completed)<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle/#footnote_8_402" id="identifier_8_402" class="footnote-link footnote-identifier-link" title="however, it is a non-trivial undertaking if you need that push to happen on multiple machines. Yes, something like mcollective makes the multiple machine part easy. The hard part is matching the business logic Puppet will use to determine which machines should get that new config in something else outside of Puppet so the push happens only on the required machines.">9</a></sup></li>
</ol>
<p>One hidden drawback of this method which was pointed out to me by a Puppet Labs person is that your VCS changelog tends to get cluttered with trivial changes. If one of the goals of using a VCS in the first place is to have a change log where it is easy to determine what changes happen to your infrastructure over time, it gets annoying when the majority of log messages say &#8220;Typo&#8230;Typo&#8230;Damn&#8230;Fixed a spelling error&#8230;Almost got it&#8230;Nope, not yet&#8230;<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle/#footnote_9_402" id="identifier_9_402" class="footnote-link footnote-identifier-link" title="yes, various VCS systems have ways to bundle/edit commit log messages, but then the burden shifts to the humans to keep their their commit logs tidy or to go back and edit them. And we all know how that story ends.">10</a></sup></p>
<p>Another interesting consequence of this method comes when we&#8217;re working to develop a configuration which is not as localized as the one used in our example so far. Imagine we&#8217;re developing a configuration for a service that runs on all of your machines. You have to make sure that the &#8220;in development&#8221; changes aren&#8217;t prematurely propagated out to all of the machines. There are a number of ways you can do this, for example:</p>
<ul>
<li>change the Puppet config so the modified file is targeted to be specific to the machine, then change it so it becomes applicable to a larger scope. This means you are changing not only the service&#8217;s config, but also the configuration management system&#8217;s config. Best keep your wits about you.</li>
<li>a less &#8220;one-off&#8221; variation of the previous idea is to use Puppet environments to label the machine you are working on as &#8220;special.&#8221; You then develop your configs first in a &#8220;special&#8221; place before moving them over to the standard location. You can also create a similar scheme using either Facter or an external node configuration. All of these methods force you to engineer your Puppet infrastructure to take this workflow into account<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle/#footnote_10_402" id="identifier_10_402" class="footnote-link footnote-identifier-link" title="perhaps not such a bad thing">11</a></sup>. But you have to have thought of this before hand.</li>
</ul>
<h1>Question 2: How Do Configs Get from the VCS Respository to the Puppet Datastore?</h1>
<p>We almost touched on this in the last section, but I want to shine a more direct light on this dark little corner as well.  This is the question of how you control the flow of data that resides in your version control system to the place where the Puppet server sees the data and can serve it to its clients. I&#8217;ve heard of three different ways people are doing this:</p>
<ol>
<li>A job gets run periodically on the Puppet server to &#8220;check out&#8221; any changes to the VCS repository. The Puppet server either looks into this working copy for its files or a subsequent part of the job copies<sup><a href="http://www.otterbook.com/blog/2011/05/puppet-puzzle/#footnote_11_402" id="identifier_11_402" class="footnote-link footnote-identifier-link" title="cp, rsync, what have you">12</a></sup> the whole or just changed data into the Puppet server&#8217;s datastore.</li>
<li>The VCS has a post-commit hook added to the repository so that when a magical commit takes place (e.g. the change is tagged in a particular way or the commit happens to a specific branch) the VCS copies the appropriate files to the Puppet datastore.</li>
<li>The Puppet server itself gets taught how to be a client of the VCS system and to look right into the VCS tree (e.g. through a web interface via HTTP) for files with specific branches or tags each time it runs. An alternative version of this is to have the Puppet server consult a config file (e.g. that has version numbers in it) which describes the latest version of a branch of the VCS repository. If the config file holds a version number later than the one in the Puppet repository, a check out is performed.</li>
</ol>
<p>As you can imagine, things get trickier when we try to run the options from Question #1 into the options for Question #2 and we don&#8217;t quite get the candy bar we&#8217;d hoped. Clearly some of the options for how the data gets from the VCS into Puppet are more amenable to &#8220;I just made a change, do it now!&#8221; than others.</p>
<h1>So, What&#8217;s the Right Thing To Do?</h1>
<p>Here&#8217;s the scenario we&#8217;re describing: &#8220;You have a config file you need to iteratively change. This config file is kept in a version control system and managed by a configuration management system like Puppet. How do you do it?&#8221;</p>
<p>Some of the ideas we discussed above seem more or less &#8220;hackish&#8221; to me, but none of them really describe a workflow I&#8217;m particularly enamored by. I assert that the scenario I described above is one of the most common things you would want to do with Puppet. Given that, I really want to be enamored by the workflow because it is something I&#8217;m going to have to do <em>all the time</em>. How can we make this better?</p>
<p>I&#8217;ve been pondering this question for a number of months. Here are a few larval ideas:</p>
<ol>
<li>closer integration between Puppet and (some abstract layer on top of the more popular VCS systems). There&#8217;s a lot that could be done if a Puppet server could have easy read/write access to the VCS.</li>
<li>create a way for a Puppet client to have a different relationship with the server than the current dom/sub paradigm where the client meekly says &#8220;Got anything for me? and the server says &#8220;Yes, and you will take it, and use it to overwrite what you have.&#8221;  This would be best if this different relationship could be temporary and just for a single file or directory. That way you may be able to say &#8220;take this web server config file and treat it specially. The client version will eventually be considered the canonical one. Scoop it up when I say I&#8217;m ready for it to return to the server.&#8221; This is one of the benefits of #1 above.</li>
<li>another, perhaps simpler twist on the former item, provide a way to just a &#8220;lock this file from Puppet propagated changes&#8221; would help. It would certainly be nicer than &#8220;I&#8217;m taking Puppet down on this machine to avoid having my changes overwritten.&#8221;</li>
</ol>
<p>I don&#8217;t think I&#8217;ve gotten close to licking this problem with these ideas, so I&#8217;d really like to discuss this with people who want to grapple with the same problem. Please feel free to comment on this post or get in touch with me via the comment form here on the site. Let&#8217;s talk about it.</p>
<p>The plot thickens&#8230; see the <a title="The Puppet Puzzle Becomes More Perspicuous" href="http://www.otterbook.com/blog/2011/05/puppet-puzzle-2/">next post in this series</a>.</p>
<ol class="footnotes"><li id="footnote_0_402" class="footnote">and most other config mgmt tools, so even if you use another config mgmt system, I&#8217;d still love your input</li><li id="footnote_1_402" class="footnote">for the purpose of this discussion, it does not matter whether or not this web server is considered production or dev, though if it is the former this question becomes a bit more interesting.</li><li id="footnote_2_402" class="footnote">or the Puppet client is run every N minutes from <em>cron</em></li><li id="footnote_3_402" class="footnote">vs. some automated generation of that configuration</li><li id="footnote_4_402" class="footnote"> we could play beat the clock, but that seems treacherous. It causes people to have to pay attention to an unnecessary time limit. If they get up to pee, they risk  having to revert their changes from the backup copy Puppet leaves behind.</li><li id="footnote_5_402" class="footnote">as an aside, bcfg2 handles this situation really nicely. It knows how to specify that the changed copy on local disk should now be considered the true version and to suck that change back into the bcfg2 configuration with a minimal amount of effort.</li><li id="footnote_6_402" class="footnote">you did remember to restart it, right?</li><li id="footnote_7_402" class="footnote">yes, you can and probably should run some sort of Puppet dry-run report that would tell you if you blew it, but why set up a situation that is bound to fail due to human error?</li><li id="footnote_8_402" class="footnote">however, it is a non-trivial undertaking if you need that push to happen on multiple machines. Yes, something like <a href="http://docs.puppetlabs.com/mcollective/" target="_blank">mcollective</a> makes the multiple machine part easy. The hard part is matching the business logic Puppet will use to determine which machines should get that new config in something else outside of Puppet so the push happens only on the required machines.</li><li id="footnote_9_402" class="footnote">yes, various VCS systems have ways to bundle/edit commit log messages, but then the burden shifts to the humans to keep their their commit logs tidy or to go back and edit them. And we all know how that story ends.</li><li id="footnote_10_402" class="footnote">perhaps not such a bad thing</li><li id="footnote_11_402" class="footnote">cp, rsync, what have you</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.otterbook.com/blog/2011/05/puppet-puzzle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Saving the World, One Sea Otter at a Time</title>
		<link>http://www.otterbook.com/blog/2010/07/saving-the-world-one-sea-otter-at-a-time/</link>
		<comments>http://www.otterbook.com/blog/2010/07/saving-the-world-one-sea-otter-at-a-time/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 03:46:46 +0000</pubDate>
		<dc:creator>dnb</dc:creator>
				<category><![CDATA[otters]]></category>

		<guid isPermaLink="false">http://www.otterbook.com/?p=392</guid>
		<description><![CDATA[I feel that I would be terribly remiss if I didn&#8217;t point people to Michael Reilly&#8217;s Discovery News article Sea Otters, the Cutest Way to Fight Global Warming. It notes a new study mentioned in New Scientist is suggesting Sea Otters have an unexpected and pretty significant role in combatting global warming. Yet another reason [...]]]></description>
				<content:encoded><![CDATA[<p></p><p>I feel that I would be terribly remiss if I didn&#8217;t point people to Michael Reilly&#8217;s <a href="http://news.discovery.com/">Discovery News</a> article <a href="http://news.discovery.com/earth/sea-otters-the-cutest-way-to-fight-global-warming.html">Sea Otters, the Cutest Way to Fight Global Warming</a>. It notes a <a href="http://www.newscientist.com/article/dn19145-sea-otters-worth-700-million-in-carbon-credits.html">new study mentioned in New Scientist</a> is suggesting Sea Otters have an unexpected and pretty significant role in combatting global warming.</p>
<p>Yet another reason to work towards <a href="http://www.otterbook.com/otters/">helping the sea otters</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otterbook.com/blog/2010/07/saving-the-world-one-sea-otter-at-a-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Lawyer and the SysAdmin</title>
		<link>http://www.otterbook.com/blog/2010/04/the-lawyer-and-the-sysadmin/</link>
		<comments>http://www.otterbook.com/blog/2010/04/the-lawyer-and-the-sysadmin/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 22:27:01 +0000</pubDate>
		<dc:creator>dnb</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[joke]]></category>

		<guid isPermaLink="false">http://www.otterbook.com/?p=383</guid>
		<description><![CDATA[Warning: dumb joke modified from a dumb joke that used to contain a character of a certain ethnicity. Also note: this is not representative of lawyers in general so please do not sue me. A lawyer and an SysAdmin are sitting next to each other on a long flight. The lawyer is thinking that SysAdmins [...]]]></description>
				<content:encoded><![CDATA[<p></p><p><strong>Warning</strong>: dumb joke modified from a dumb joke that used to contain a character of a certain ethnicity.  <em>Also note:</em> this is not representative of lawyers in general so please do not sue me.</p>
<p>A lawyer and an SysAdmin are sitting next to each other on a long flight.  The lawyer is thinking that SysAdmins are so dumb that he could get an advantage over on them easy&#8230;</p>
<p>So the lawyer asks if the SysAdmin would like to play a fun game. The SysAdmin is tired and just wants to take a nap, so he politely declines and tries to catch a few winks. The lawyer persists, and says that the game is a lot of fun. &#8220;I ask you a question, and if you don&#8217;t know the answer, you pay me only $5; you ask me one, and if I don&#8217;t know the answer, I will pay you $500,&#8221; he says. </p>
<p>This catches the SysAdmin&#8217;s attention and to keep the lawyer quiet, he agrees to play the game.</p>
<p>The lawyer asks the first question. &#8220;What&#8217;s the distance from the Earth to the Moon?&#8221;</p>
<p>The SysAdmin doesn&#8217;t say a word, reaches in his pocket, pulls out a five-dollar bill, and hands it to the lawyer.</p>
<p>Now, it&#8217;s the SysAdmin&#8217;s turn. He asks the lawyer, &#8220;What goes up a  hill with three legs, and comes down with four?&#8221; The lawyer uses his  laptop and searches all references he could find on the Net. He sends e-mails to all the smart friends he knows, all to no avail.  After one hour of searching he finally gives up. He wakes up the SysAdmin and hands him $500. The SysAdmin pockets the $500 and goes right back to sleep.</p>
<p>The lawyer is going nuts not knowing the answer. He wakes the SysAdmin up and asks, &#8220;Well, so what goes up a hill with three legs and comes down with four?&#8221;</p>
<p>The SysAdmin reaches in his pocket, hands the lawyer $5 and goes back to sleep.</p>
<p>Don&#8217;t mess with SysAdmins!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otterbook.com/blog/2010/04/the-lawyer-and-the-sysadmin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simon says&#8230;Restart Your Daemons</title>
		<link>http://www.otterbook.com/blog/2010/04/simon-says-restart-your-daemons/</link>
		<comments>http://www.otterbook.com/blog/2010/04/simon-says-restart-your-daemons/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 03:35:51 +0000</pubDate>
		<dc:creator>dnb</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[iTerm]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[tmux]]></category>

		<guid isPermaLink="false">http://www.otterbook.com/?p=376</guid>
		<description><![CDATA[I&#8217;m all for performing service management using mechanisms built-in to a configuration management system (i.e. you change a config file and the config management system automatically restarts the daemon), but occasionally you get into a situation where you want to interactively do the same exact thing on several machines. For example, I recently wanted to [...]]]></description>
				<content:encoded><![CDATA[<p></p><p>I&#8217;m all for performing service management using mechanisms built-in to a configuration management system (i.e. you change a config file and the config management system automatically restarts the daemon), but occasionally you get into a situation where you want to interactively do the same exact thing on several machines. </p>
<p>For example, I recently wanted to bounce the <a href="http://www.clamav.net">ClamAV</a> daemon running on four of my incoming mail servers simultaneously. This process would require the exact same commands on all four machines, ideally run at the same time. </p>
<p>Rather than type the same thing four times, let me tell you about a few programs that can help in this sort of situation where you need interactive input to multiplex to different sessions. The one I used for the last example was OSX specific (since most of my time is spent typing at a Mac laptop):</p>
<ul>
<li><a href="http://iterm.sourceforge.net/">iTerm</a> &#8211; iTerm is a spiffy rewrite of the native OSX Terminal application that has a bunch of cool features. The one I used is called &#8220;Send Input to all Tabs&#8221; (under the Shell menu). iTerm lets you run multiple sessions in different tabs of the same window. When you turn &#8220;Send Input to all Tabs&#8221; anything you type in one tab is automatically echoed to every other tab. I ssh&#8217;d to each of the mail servers, turned on this feature, and typed the commands I needed a single time, yet all four machines obeyed these commands. If you run OSX and you haven&#8217;t played with iTerm, you really should.</li>
</ul>
<p>Before I discovered this feature in iTerm, I used to use <em>cssh</em>, from <a href="http://sourceforge.net/projects/clusterssh/">ClusterSSH</a>. It opens up a smaller input window and as many other xterms as you need. Anything typed in the input window is echoed to those windows. This program isn&#8217;t OSX specific, it can be used any place you can build the right Perl modules. I stopped using it a while back because I had issues with it building under <a href="http://www.macports.org/">MacPorts</a> (if I built the modules it needed using the Apple-provided Perl libraries, everything was peachy, but building it into MacPorts in an attempt to avoid polluting the OSX install of Perl lead to a script that would segfault upon running).</p>
<p>I recently noticed a new rewrite of the same idea for OSX called <a href="http://code.google.com/p/csshx/">csshx</a>. It uses the native OSX terminal vs. X11. I haven&#8217;t tried it, but it looks promising. I suspect there are other utilities like this available. I wouldn&#8217;t be surprised if there was a way to do this with <a href="http://www.gnu.org/software/screen/">GNU Screen</a> or <a href="http://tmux.sourceforge.net/">tmux</a>. Are there any you use for this sort if interactive multiplexing that I&#8217;m missing?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otterbook.com/blog/2010/04/simon-says-restart-your-daemons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enough About Me&#8230;What Do You Think of Me?</title>
		<link>http://www.otterbook.com/blog/2010/04/enough-about-me-what-do-you-think-of-me/</link>
		<comments>http://www.otterbook.com/blog/2010/04/enough-about-me-what-do-you-think-of-me/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 03:14:42 +0000</pubDate>
		<dc:creator>dnb</dc:creator>
				<category><![CDATA[meta]]></category>
		<category><![CDATA[author]]></category>
		<category><![CDATA[BBLISA]]></category>
		<category><![CDATA[PICC]]></category>
		<category><![CDATA[USENIX]]></category>

		<guid isPermaLink="false">http://www.otterbook.com/?p=369</guid>
		<description><![CDATA[Sorry I left this blog languish for a bit. Let me catch you up on a few things that have happened in my professional life in rough chronological order: I was quite surprised (stunned really, ask me about it some time) and tremendously honored to receive the 2009 SAGE Outstanding Achievement Award at the last [...]]]></description>
				<content:encoded><![CDATA[<p></p><p>Sorry I left this blog languish for a bit. Let me catch you up on a few things that have happened in my professional life in rough chronological order:</p>
<ul>
<li>I was quite surprised (stunned really, ask me about it some time) and tremendously honored to receive the <a href="http://www.sage.org/about/outstanding.html">2009 SAGE Outstanding Achievement Award</a> at the last LISA. For those who were not at the 2009 LISA, you missed my <a href="http://www.youtube.com/watch?v=9PBQ0BAEgHU">1985 Sally Fields acceptance speech</a> imitation.</li>
<li>It was great to have the opportunity to present to the other sysadmins in the &#8216;hood at the <a href="http://www.bblisa.org/past.html">January 2010</a> <a href="http://www.bblisa.org/">BBLISA</a> meeting.</li>
<li>At a friend&#8217;s urging, I ran for and was elected to a seat on the <a href="http://www.usenix.org/about/elections10results.html">USENIX&#8217;s Board of Directors</a>. If you haven&#8217;t heard of <a href="http://www.usenix.org">USENIX</a> before, it is the organization that sponsors the <a href="http://www.usenix.org/events/byname/lisa.html">LISA conference</a> (and some other great ones). Come June, I look forward to serving USENIX and the wider sysadmin community in that capacity to the best of my ability. Thanks to those who voted to give me that opportunity.</li>
<li>I&#8217;m also very honored to be asked to give the opening keynote session at the upcoming <a href="http://lopsanj.org/events/picc10/">PICC Conference</a> sponsored by <a href="http://lopsanj.org/">LOPSA-NJ</a>. I&#8217;ve also been asked to teach a class there based on this website&#8217;s <a href="http://www.otterbook.com/the-book/">favorite book</a>. PICC is the first regional conference I&#8217;ve attended in a while and I think it is going to be great.</li>
</ul>
<p>That&#8217;s what is up with me. How are things with you?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otterbook.com/blog/2010/04/enough-about-me-what-do-you-think-of-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speeding Up fsck/fsck_hsfs on OSX</title>
		<link>http://www.otterbook.com/blog/2010/01/speeding-up-an-fsckfsck_hsfs-on-osx/</link>
		<comments>http://www.otterbook.com/blog/2010/01/speeding-up-an-fsckfsck_hsfs-on-osx/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 01:15:39 +0000</pubDate>
		<dc:creator>dnb</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[fsck]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://www.otterbook.com/?p=357</guid>
		<description><![CDATA[Here&#8217;s a quick tip on how to make an fsck (or specifically an fsck_hsfs) run much faster. I learned this as part of debugging some corruption with the backup image on my Time Capsule. where {%mem} is &#189; to 1&#8260;3rd the amount of memory you have in your computer. If you need to determine the [...]]]></description>
				<content:encoded><![CDATA[<p></p><p>Here&#8217;s a quick tip on how to make an <span class="command">fsck</span> (or specifically an <span class="command">fsck_hsfs</span>) run <em>much</em> faster. I learned this as part of debugging some corruption with the backup image on my Time Capsule.</p>
<pre class="brush: bash; title: ; notranslate">/bin/fsck_hfs -f -d -c {%mem} /dev/rdisk{N}</pre>
<p>where <span class="variable">{%mem}</span> is  &#189; to 1&#8260;3rd the amount of memory you have in your computer. If you need to determine the amount of memory in a machine from the command line, a great blog post on <a href="http://juretta.com/log/2007/02/04/mac_os_x_command_line_goodies/">Mac OS X Command Line Goodies</a> suggests you can  use:</p>
<pre class="brush: bash; title: ; notranslate">
/usr/sbin/system_profiler SPHardwareDataType | grep Memory
</pre>
<p>For example, you can use <span class="command">-c 512m</span> if you have a 1GB machine. </p>
<p>and  </p>
<p><span class="variable">{N}</span> is the correct device node. This command will show you the list of disk nodes:</p>
<pre class="brush: bash; title: ; notranslate">diskutil list</pre>
<p>For example, you might use <span class="command">/dev/rdisk0s2</span>.</p>
<p>The <span class="command">-d</span> turns on debugging and <span class="command">-f</span> instructs <span class="command">fsck_hsfs</span> to force a repair if it finds any problems.</p>
<p>In case you were curious, the <span class="command">-c</span> setting is the part of the incantation that gives it its real magic. It lets the command cache a considerable amount of information in memory and that speeds up any scan a tremendous amount. If you ever run a disk repair from Disk Utility, you&#8217;ll notice the <span class="command">fsck_hsfs</span> command it spawns lacks this option and hence is much slower.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otterbook.com/blog/2010/01/speeding-up-an-fsckfsck_hsfs-on-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some lovely SSL resources</title>
		<link>http://www.otterbook.com/blog/2009/12/some-lovely-ssl-resources/</link>
		<comments>http://www.otterbook.com/blog/2009/12/some-lovely-ssl-resources/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 20:25:47 +0000</pubDate>
		<dc:creator>dnb</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://www.otterbook.com/?p=351</guid>
		<description><![CDATA[Just had to deal with a total swap out of all of my SSL certificates at work thanks to the ipsCA screwup that also nailed Bob Plankers and Chris Siebenmann and I&#8217;m sure lots of other sites (especially .edu). I&#8217;m really peeved too, but rather than hissing and spitting like I really feel like doing, [...]]]></description>
				<content:encoded><![CDATA[<p></p><p>Just had to deal with a total swap out of all of my SSL certificates at work thanks to the ipsCA screwup that also nailed <a href="http://lonesysadmin.net/2009/12/22/ipsca-getting-what-you-pay-for/">Bob Plankers</a> and <a href="http://utcc.utoronto.ca/~cks/space/blog/web/SSLCAFailure">Chris Siebenmann</a> and I&#8217;m sure lots of other sites (especially .edu). I&#8217;m really peeved too, but rather than hissing and spitting like I really feel like doing, let me pass on a few SSL resources that I found useful while debugging the new chained certs we started using:</p>
<ul>
<li><a href="http://wiki.debian.org/SSLkeys">Debian&#8217;s SSL keys page</a> is a lovely resource for where and how each common open source package keeps its particular SSL-related configs. Your file system locations may vary but this at least gives you a start for the 30+ packages they list</li>
<li>UnixCraft&#8217;s <a href="http://www.cyberciti.biz/faq/test-ssl-certificates-diagnosis-ssl-certificate/">How To Verify SSL Certificate From a Shell Prompt</a> is a swell tutorial on the various <a href="http://www.openssl.org/">openssl</a> command line options you can use to debug certs. </li>
<li>Paul Heinlein&#8217;s <a href="http://www.madboa.com/geek/openssl/">OpenSSL Command-Line HOWTO</a> is a great HOWTO for all sorts of openssl operations.</li>
<li>The <a href="http://www.openssl.org/docs/apps/verify.html">OpenSSL verify manual page</a> lists the error messages you might get when attempting to verify, for example, a chained cert.</li>
<li><a href="http://www.sslshopper.com">SSLShopper.com</a>, in addition to being a good place to compare certificate authorities, has a surprising amount of really good technical information about all things SSL. For example, <a href="http://www.sslshopper.com/article-most-common-java-keytool-keystore-commands.html">The Most Common Java Keytool Keystore Commands</a> and 	<a href="http://www.sslshopper.com/article-most-common-openssl-commands.html">The Most Common OpenSSL Commands</a> are genuinely useful.</li>
</ul>
<p>Hope this are helpful to you should you get put in the same bind.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otterbook.com/blog/2009/12/some-lovely-ssl-resources/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where Have You Been All My Life? Rlwrap</title>
		<link>http://www.otterbook.com/blog/2009/12/where-have-you-been-all-my-life-rlwrap/</link>
		<comments>http://www.otterbook.com/blog/2009/12/where-have-you-been-all-my-life-rlwrap/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 03:42:21 +0000</pubDate>
		<dc:creator>dnb</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[rlwrap]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.otterbook.com/?p=342</guid>
		<description><![CDATA[Back in the days of yore (when sysadmins still had to bang two rocks together to do their job), we didn&#8217;t have command line history. No, we typed every command by hand. If we had to type the same 110-character command-line several times, we typed those 550 characters ourselves, mistakes and all, and by gum, [...]]]></description>
				<content:encoded><![CDATA[<p></p><p>Back in the days of yore (when sysadmins still had to bang two rocks together to do their job), we didn&#8217;t have command line history. No, we typed every command by hand. If we had to type the same 110-character command-line several times, we typed those 550 characters ourselves, mistakes and all, and by gum, we LIKED it! </p>
<p>And then shells became available with history functionality and, well, we kind of liked that too. And, um, then came along libraries like <a href="http://en.wikipedia.org/wiki/GNU_readline">GNU readline</a> that were written to provide even more pleasant, vizz-eee-ul history recall and editing to anything that presents a command line prompt, and well, ok, we REALLY that too. Because, quite frankly, typing long command line strings over and over again, sometimes because our typing skills aren&#8217;t always sharp, is a real drag.</p>
<p>But alas, not every program that provides a command-line prompt or handles interactive input provides this new-fangled user experience (I&#8217;m looking at you <a href="http://en.wikipedia.org/wiki/SQL*Plus">sqlplus</a>, maybe if scott had a real tiger&#8230;). In the past, a sysadmin had to look admonishingly at one of these programs, perhaps working around the lack of interface using something like <a href="http://expect.nist.gov/">Expect</a>.</p>
<p>Maybe I&#8217;m the last admin on the planet to hear about this idea, but it came as a pleasant surprise to find out that there are a number of programs out there whose whole purpose in life is to add the readline-yumminess to programs that don&#8217;t have it already. The first one I encountered was <a href="http://utopia.knoware.nl/~hlub/uck/rlwrap">rlwrap</a> by Hans Lub. Now you can type:</p>
<pre class="brush: bash; title: ; notranslate">
$ rlwrap sqlplus scott/tiger@oracle_instance
</pre>
<p>And you get a reasonable command-line environment even from within sqlplus.</p>
<p>I know I would have offered at least a vestigial body part several times in the past to have the &#8220;add readline to command X&#8221; super power several times during my career. (apparently this tip has been <a href="http://sysdba.wordpress.com/2006/10/08/how-to-use-rlwrap-to-get-a-command-history-in-sqlplus/">making people in the Oracle community happy</a> for a while now).  </p>
<p>The <a href="http://utopia.knoware.nl/~hlub/uck/rlwrap/README.txt">rlwrap README</a> mentions two other similar packages: rlfe which even ships with the GNU readline distribution and <a href="http://kaolin.unice.fr/Cle/">cle</a>. I note that cle hasn&#8217;t been touched for over ten years (the last release&#8217;s 10th birthday was just over a week ago). I can&#8217;t speak to how well rlfe works, but kudos to Lub for continuing to update the rlwrap package.</p>
<p>Hope this tip brings you a similar amount of joy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otterbook.com/blog/2009/12/where-have-you-been-all-my-life-rlwrap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using n/a (User agent is rejected)
Database Caching 5/25 queries in 0.013 seconds using disk

 Served from: www.otterbook.com @ 2013-06-18 01:33:01 by W3 Total Cache -->