<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;CkQERX4_fyp7ImA9WhBVEkg.&quot;"><id>tag:blogger.com,1999:blog-1083699665345453745</id><updated>2013-04-17T18:58:24.047-07:00</updated><category term="devops" /><category term="chef" /><title>devopsanywhere</title><subtitle type="html">It's cloudy all over</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://devopsanywhere.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://devopsanywhere.blogspot.com/" /><author><name>Bryan Berry</name><uri>https://plus.google.com/106664679333642993534</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-TyULMG7ZA6A/AAAAAAAAAAI/AAAAAAAAAAA/wjGutwhuhAU/s512-c/photo.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>18</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/Devopsanywhere" /><feedburner:info uri="devopsanywhere" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;Dk8EQng_cCp7ImA9WhBTFUs.&quot;"><id>tag:blogger.com,1999:blog-1083699665345453745.post-6709913488007216571</id><published>2013-02-10T22:39:00.001-08:00</published><updated>2013-02-10T22:40:03.648-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-10T22:40:03.648-08:00</app:edited><title>SysAdmin Productivity and Chef</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Inspired by Nathen Harvey's &lt;a href="https://speakerdeck.com/nathenharvey/learning-to-automate"&gt;"Learning to Automate"&lt;/a&gt; presentation, I came up with this graph of system administrator productivity. Enjoy&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-sxWM43S7s4A/URiR3QKKIlI/AAAAAAAAG2c/Y9RYmG9C94M/s1600/sysadmin_productivity.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="588" src="http://2.bp.blogspot.com/-sxWM43S7s4A/URiR3QKKIlI/AAAAAAAAG2c/Y9RYmG9C94M/s640/sysadmin_productivity.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/Devopsanywhere/~4/QUNFoRtsW_c" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://devopsanywhere.blogspot.com/feeds/6709913488007216571/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://devopsanywhere.blogspot.com/2013/02/sysadmin-productivity-and-chef.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/6709913488007216571?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/6709913488007216571?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Devopsanywhere/~3/QUNFoRtsW_c/sysadmin-productivity-and-chef.html" title="SysAdmin Productivity and Chef" /><author><name>Bryan Berry</name><uri>https://plus.google.com/106664679333642993534</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-TyULMG7ZA6A/AAAAAAAAAAI/AAAAAAAAAAA/wjGutwhuhAU/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-sxWM43S7s4A/URiR3QKKIlI/AAAAAAAAG2c/Y9RYmG9C94M/s72-c/sysadmin_productivity.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://devopsanywhere.blogspot.com/2013/02/sysadmin-productivity-and-chef.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE4EQn86fyp7ImA9WhNRF04.&quot;"><id>tag:blogger.com,1999:blog-1083699665345453745.post-2987920115480194189</id><published>2012-11-10T11:53:00.002-08:00</published><updated>2012-11-12T08:15:03.117-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-12T08:15:03.117-08:00</app:edited><title>How to Write Reusable Chef Cookbooks, Gangnam Style</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
I am at pains lately to explain to others how I think Chef cookbooks should be developed. There are only a few good blog posts on the subject, most notably Peter Donald's blog posts "&lt;a href="http://realityforge.org/code/2012/05/12/evolving-towards-cookbook-reusability-in-chef.html"&gt;Evolving Towards Cookbook Reusability&lt;/a&gt;" &amp;nbsp; and &lt;a href="http://realityforge.org/code/2012/11/12/reusable-cookbooks-revisited.html"&gt;Reusable Cookbooks Revisited&lt;/a&gt; and Jamie Winsor's "&lt;a href="http://vialstudios.com/guide-authoring-cookbooks.html"&gt;Authoring a Chef Cookbook as a Developer&lt;/a&gt;." These articles have influenced me significantly, as well Jamie Winsor's &lt;a href="http://foodfightshow.org/2012/08/jamie-winsor-and-michael-ivey-skool-us-on-berkshelf.html"&gt;appearance on the FoodFightShow podcast&lt;/a&gt;.&amp;nbsp;Both Jamie and Peter urge toward creating generic, attribute-driven cookbook wrapped with a policy-driven cookbook. That's a complex topic that we will come back to later. Jamie recommends something similar with his distinction between "library" and "application" cookbooks. Jamie has also convinced me that Chef's Roles are to be avoided. Some people alternately call this pattern "library + application" or "generic + wrapper." For lack of a better name, I call this way of cooking infrastructure &lt;i&gt;&lt;b&gt;Gangnam Style&lt;/b&gt;&lt;/i&gt;.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
If you look closely at this image, you can see that Korean rapper PSY is subtly sending us a message about Chef cookbook development.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-zFeVAkdfpoY/UJ-sccyDdhI/AAAAAAAAEzQ/lKyugwsnnl0/s1600/psy_hands.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="305" src="http://3.bp.blogspot.com/-zFeVAkdfpoY/UJ-sccyDdhI/AAAAAAAAEzQ/lKyugwsnnl0/s400/psy_hands.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
Why are roles bad? Why do you need to write two cookbooks rather than one? Well, this all boils down to cookbook development workflow. I start by developing locally on my workstation using Vagrant, &lt;a href="http://berkshelf.com/"&gt;Berkshelf&lt;/a&gt;, and Chef Solo. I find using Chef Solo with a local Vagrant VM much faster than working with a Chef Server. This has the added benefit that you will be able to share your library cookbooks with people outside of your immediate organization. This can help a lot when you look to the community for help fixing a thorny issue. Now you can use roles with Chef Solo, but in my opinion, it is a very bad idea. You will have two copies of a given role, one copy in a given cookbook and the main copy in your chef-repo code repository. Syncing the two will introduce errors and complexity unnecessarily. Roles are also a big fat global variable across your entire infrastructure. You can't version them. You can't roll out a new role incrementally. Changing a role instantly affects every node that uses it regardless of its environment.&lt;br /&gt;
&lt;br /&gt;
It is critical to use a &lt;i&gt;transient&lt;/i&gt; virtual machine for cookbook development. You can't really be sure that your cookbook works properly until your delete your virtual machine then reprovision it from scratch.&lt;br /&gt;
&lt;br /&gt;
For the purpose of this article, let's say I am working on a PostgreSQL cookbook for Acme Corporation. I will fork the default PostgreSQL cookbook from Opscode and only make changes to that cookbook that I will be able to push upstream later. I will put all Acme-specific values and configuration into the acme-postgresql cookbook. In the past, I would have put the Acme-specific values into a role and then done my best not to tweak the PostgreSQL cookbook in any way that infected it with Acme-specific values that couldn't or shouldn't be upstreamed. Inevitably, Acme-specific logic and data would make its way into the library cookbook and the changes would never be upstreamed.&lt;br /&gt;
&lt;br /&gt;
The Acme-PostgreSQL cookbook wraps the generic PostgreSQL cookbook with `include_recipe` and then overriding certain attributes and "editing" a few resources with chef-rewind (formerly named chef-edit). For instance, I may need to change the permissions of the main PostgreSQL configuration file because ACME's DBA team has a written policy that specifies the exact mode for that file. We can argue about whether or not the file mode is worth changing but that won't change the fact that ACME's DBA team is paying me an hourly rate on a short-term contract. If I don't fulfill their requirements to the letter, I won't get paid :). Next, I have to disable the PostgreSQL service because it is actually managed by Pacemaker.&lt;br /&gt;
&lt;br /&gt;
Once I have most of the cookbook's elements in place, I begin testing it on my own laptop using Vagrant. Once I am happy with the state of the cookbook, I will deploy it to a server in the QA or Test environment. I am very strict about which cookbook versions are allowed by my environments. In case these two cookbooks are already in use, I make sure that I have incremented the cookbook versions in metadata.rb so they will not be loaded into a production environment accidentally. In the past, I would have to change a role used by both Production and QA servers. This was bad, very bad. Using a wrapper cookbook I can avoid this possibility entirely while keeping all of the benefits of a role.&lt;br /&gt;
&lt;br /&gt;
Once I have deployed to a QA server, I monitor it for anything unexpected. In the case of my haproxy servers, I actually have written a set of integration tests using &lt;a href="http://rspec.info/"&gt;Rspec&lt;/a&gt;. If everything goes OK after a couple days, I will go increment the version of the wrapper cookbook allowed on the production environment to that of the new version and run chef-client on the target production servers.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-wA-o8Yb48Ho/UJ6LWe4qkBI/AAAAAAAAEyg/-wfzozl1s6w/s1600/cookbook_life_cycle.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-wA-o8Yb48Ho/UJ6LWe4qkBI/AAAAAAAAEyg/-wfzozl1s6w/s1600/cookbook_life_cycle.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Now what if we had chosen to use roles? Well then the deployment to QA would have been a Hell of a lot more nerve-wracking. Unfortunately, I have made the error in the past of adding an error to a base role. Luckily I caught it before it affected more than a couple servers.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-5DmmoeFZkQw/UJ6SIWQzOXI/AAAAAAAAEyw/uenb2wdwGUE/s1600/cookbook_life_cycle_w_roles.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-5DmmoeFZkQw/UJ6SIWQzOXI/AAAAAAAAEyw/uenb2wdwGUE/s1600/cookbook_life_cycle_w_roles.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
So far I have explained how I distinguish between Library and Application Cookbooks but here is a table that I think will help you visualize those distinctions.&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-1NQTb3vxQnA/UJ6SrYEafHI/AAAAAAAAEy4/_dZjl8rEWtM/s1600/library_app.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img alt="" border="0" height="312" src="http://2.bp.blogspot.com/-1NQTb3vxQnA/UJ6SrYEafHI/AAAAAAAAEy4/_dZjl8rEWtM/s640/library_app.png" title="Gangnam Style Cookbook Pattern" width="640" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Gangnam Style Cookbook Pattern&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
Recently, there was an awesome &lt;a href="http://www.youtube.com/watch?v=x0LoqaKbu2g&amp;amp;feature=plcp"&gt;Chef Hangout on Cookbook Reusability&lt;/a&gt; which you should definitely check out. Some participants said that editing resources with chef-rewind (it was called chef-edit at the time of the hangout) has a bad code smell, i.e. a pattern to be avoided. I argued then as I do now that this pattern is one of many tools we can use to make cookbooks reusable. I like it because it is the simplest thing that could possibly work. I could modify the underlying postgresql cookbook so that I can paremeterize those settings that I customize. In that case, I would still want to put the attributes for those parameters in the acme-postgresql recipe. For me personally, modifying a generic cookbook requires a lot of careful thought in order to avoid breaking functionality for users on other platforms. When I am pressed for time and doubt that I will get around to pushing my changes upstream, I prefer to use chef-rewind to override specific resources.&lt;br /&gt;
&lt;br /&gt;
This bears more attention. In any open-source project, regardless of how well run it is, it is easier to pull upstream changes than push changes upstream. The team at Opscode does a great job of integrating changes in my humble opinion, but they have to make sure that any change you introduce doesn't break functionality for other users. For this reason, I recommend avoiding changes to the Opscode cookbooks unless there is a compelling reason to. This you way you will benefit from their ongoing maintenance and updates of the community cookbooks.&lt;br /&gt;
&lt;br /&gt;
When should you only write one cookbook rather than two? Whenever you are writing something that is purely generic, you only need one cookbook. As soon as you start putting in application-specific data, I recommend splitting that application cookbook into a wrapper cookbook. I recommend this even if you never intend to open-source your generic cookbook. The flexibility you gain will save your ass later.&lt;br /&gt;
&lt;br /&gt;
On the &lt;a href="http://www.youtube.com/watch?v=x0LoqaKbu2g&amp;amp;feature=plcp"&gt;Cookbook Reusability Hangout&lt;/a&gt; there was a lot of talk of providing better abstractions and the need to provide general purpose LWRPs and DSLs for popular software applications. Adam Jacob made a great counterpoint with this argument "You could write a complete Ruby DSL for haproxy but would it be worth the engineering effort? I doubt it." Note: This is paraphrased. I tend to agree with Adam here, you could write a DSL for some configuration languages but sometimes it isn't worth the effort for the more complex ones. It especially isn't worth it if the DSL is more complex or harder to interpret than the original. Remember, the source configuration language may be a pain in the ass but at least it is documented and its problems known. The same likely cannot be said for your new DSL or LWRP. An LWRP has to be an order of magnitude simpler and more intuitive than the outputted source in order to be worth the effort.&lt;br /&gt;
&lt;br /&gt;
I recently had the pleasure to work on a &lt;a href="https://github.com/pyr/collectd-dsl"&gt;DSL for collectd plugins&lt;/a&gt; with Pierre Yves Ritschard. I really this DSL works because the collectd configuration language is ridiculously simple. Here is an example:&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/4052187.js?file=collectd_dsl.rb"&gt;&lt;/script&gt;

&lt;br /&gt;
&lt;pre&gt;config = Collectd::DSL.parse do
  load_plugin :redis
  load_plugin :java
  load_plugin :disk

  plugin :disk do
    disk "/dev/sda"
    disk "/dev/sdb"
    ignore_selected "false"
  end
end
&lt;/pre&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;br /&gt;
With collectd, the scope of configuring plugins is really quite narrow and provides an excellent opportunity for a DSL. This is where DSL's and LWRPs really shine: Providing conventions for either small problems or subsets of large problems. For example, I think it would be foolhardy to write a general purpose Ruby DSL for JBoss's XML configuration which covers tens of different J2EE service profiles from messaging to mail to clustered caching. I do believe, however, that it would be feasible to write a DSL for the most common set of configurations for JBoss's Web Profile.&lt;br /&gt;
&lt;br /&gt;
Let's step back for a second and think about how we would use the collectd DSL from the above example. We could add a recipe to the collectd cookbook collectd::acme_plugins that uses that DSL for our custom-configured plugins. However, we would be far better off creating a new cookbook acme-collectd with the recipe named plugins. Whether or not you choose to use roles, wrapper cookbooks give you a lot of flexibility.&lt;br /&gt;
&lt;br /&gt;
I too would love to parameterize all the cookbooks and LWRP all the things but we need to make sure that our abstractions are significantly easier to use than the source configuration languages. We also need an array of strategies to make cookbooks more reusable rather than one true path. In this post, I strongly advocate the &lt;i&gt;&lt;b&gt;Gangnam Style&lt;/b&gt;&lt;/i&gt; pattern to wrap a generic cookbook with one which holds application-specific logic and data. Whatever whacky patterns we come up with, we will never move forward as a community (and profession) if we do not succeed in making cookbooks reusable.&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
&lt;i&gt;P.S. Nathen Harvey helped edit this post&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;P.P.S. Thanks to those who participated in the Chef Hangout on Cookbook Reusability which greatly stimulated my thinking on this topic&lt;/i&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/Devopsanywhere/~4/o9qcR-OquXw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://devopsanywhere.blogspot.com/feeds/2987920115480194189/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://devopsanywhere.blogspot.com/2012/11/how-to-write-reusable-chef-cookbooks.html#comment-form" title="15 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/2987920115480194189?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/2987920115480194189?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Devopsanywhere/~3/o9qcR-OquXw/how-to-write-reusable-chef-cookbooks.html" title="How to Write Reusable Chef Cookbooks, Gangnam Style" /><author><name>Bryan Berry</name><uri>https://plus.google.com/106664679333642993534</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-TyULMG7ZA6A/AAAAAAAAAAI/AAAAAAAAAAA/wjGutwhuhAU/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-zFeVAkdfpoY/UJ-sccyDdhI/AAAAAAAAEzQ/lKyugwsnnl0/s72-c/psy_hands.png" height="72" width="72" /><thr:total>15</thr:total><feedburner:origLink>http://devopsanywhere.blogspot.com/2012/11/how-to-write-reusable-chef-cookbooks.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkMFRHg-eCp7ImA9WhNRFkg.&quot;"><id>tag:blogger.com,1999:blog-1083699665345453745.post-2947293054379148575</id><published>2012-11-08T01:01:00.002-08:00</published><updated>2012-11-11T08:13:35.650-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-11T08:13:35.650-08:00</app:edited><title>Rewinding Chef Resources</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;b&gt;&lt;i&gt;Note: &amp;nbsp;11 Nov 2012, the chef-edit gem was renamed chef-rewind&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
Earlier this week I realized that I misunderstood how duplicate resources are handled. When you use a resource twice, it actually is actioned &amp;nbsp;twice,
not once. The second instance will inherit attributes from the first instance but not its action.&amp;nbsp;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
For example,&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre&gt;&lt;div class="MsoNormal"&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;# jboss/recipes/default.rb&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;pre&gt;&lt;div style="font-family: Courier New, Courier, monospace;"&gt;
template “/usr/local/jboss/standalone/standalone.xml” do
  source “standalone.xml.erb”
  owner “jboss”
  mode “0755”
  notifies&amp;nbsp;resources(“service[jboss]”), :restart, :immediately
end&lt;/div&gt;
&lt;/pre&gt;
&lt;div class="MsoNormal"&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;# esb/recipes/default.rb&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;include_recipe “jboss”&lt;/span&gt;&lt;/div&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;template “/usr/local/jboss/standalone/standalone.xml” do&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; source&amp;nbsp; “prod-standalone.xml.erb”&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; owner “esb”&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; notifies&amp;nbsp;&amp;nbsp;&amp;nbsp;
    resources(“service[jboss]”), :restart, :immediately&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;end&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;/div&gt;
&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;/pre&gt;
&lt;div class="MsoNormal" style="text-align: left;"&gt;
&lt;span style="font-family: Times, 'Times New Roman', serif;"&gt;What actually happens here is that &amp;nbsp;the second template inherits the&amp;nbsp; “mode” of the 1&lt;sup&gt;st&lt;/sup&gt; template, but beyond that, itis a separate resourceservice restarted twice, on every chef run.&amp;nbsp; This is a big problem.called “&lt;a href="https://github.com/bryanwb/chef-rewind"&gt;chef-rewind&lt;/a&gt;” and it adds an addition function to chef for rewinding an&amp;nbsp;existing resource so it is only actioned once. I packaged it as a ruby gem and
not a cookbook. You can install it using `chef_gem`&amp;nbsp;When you run chef, the file will be template twice and the&amp;nbsp;I wrote a ruby gem last night that should fix this.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;/div&gt;
&lt;pre&gt;&lt;div class="MsoNormal"&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;# jboss/recipes/default.rb&lt;/span&gt;&lt;/div&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;
&lt;/span&gt;&lt;div class="MsoNormal"&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;template “/usr/local/jboss/standalone/standalone.xml” do&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; source&amp;nbsp; “standalone.xml.erb”&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; owner “jboss”&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mode&amp;nbsp;&amp;nbsp; “0755”&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; notifies&amp;nbsp;&amp;nbsp;&amp;nbsp;
    resources(“service[jboss]”), :restart, :immediately&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;end&lt;/span&gt;&lt;/div&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;
&lt;/span&gt;&lt;div class="MsoNormal"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;# esb/recipes/default.rb&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;include_recipe “jboss”&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;chef_gem “chef-rewind”&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;require ‘chef/rewind’&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;span style="font-family: Courier New, Courier, monospace;"&gt;
&lt;/span&gt;&lt;div class="MsoNormal"&gt;
&lt;b&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;rewind&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp;:template =&amp;gt; "/usr/local/jboss/standalone/standalone.xml” do&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; source&amp;nbsp; “prod-standalone.xml.erb”&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;    cookbook_name "esb"&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; owner “esb”&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;&lt;span style="font-family: Courier New, Courier, monospace;"&gt;end&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;
&lt;/span&gt;&lt;span style="font-family: Times, 'Times New Roman', serif;"&gt;Pay special attention the `cookbook_name` attribute. Without it, the resource will look for it in the jboss cookbook.
&lt;/span&gt;&lt;div class="MsoNormal"&gt;
&lt;/div&gt;
&lt;/pre&gt;
&lt;div class="MsoNormal"&gt;
This is very alpha right now and I will be testing it today. Feedback would be very much appreciated.&amp;nbsp;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/Devopsanywhere/~4/1BWsXCnqHMw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://devopsanywhere.blogspot.com/feeds/2947293054379148575/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://devopsanywhere.blogspot.com/2012/11/editing-chef-resources.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/2947293054379148575?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/2947293054379148575?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Devopsanywhere/~3/1BWsXCnqHMw/editing-chef-resources.html" title="Rewinding Chef Resources" /><author><name>Bryan Berry</name><uri>https://plus.google.com/106664679333642993534</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-TyULMG7ZA6A/AAAAAAAAAAI/AAAAAAAAAAA/wjGutwhuhAU/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://devopsanywhere.blogspot.com/2012/11/editing-chef-resources.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck8MR30yfip7ImA9WhNTGE0.&quot;"><id>tag:blogger.com,1999:blog-1083699665345453745.post-1669157846509750690</id><published>2012-10-20T12:50:00.000-07:00</published><updated>2012-10-20T23:28:06.396-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-10-20T23:28:06.396-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="devops" /><category scheme="http://www.blogger.com/atom/ns#" term="chef" /><title>A Year with Chef</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
It literally snuck up on me the other day that I had written a year ago a blog post entitled &lt;a href="http://devopsanywhere.blogspot.it/2011/10/month-with-chef.html"&gt;"A Month with Chef."&lt;/a&gt; With the Opscode Community Summit happening this coming week, I think it might be time for a few reflections.&lt;br /&gt;
&lt;br /&gt;
It is a little staggering to think about how use of Chef has impacted my work over the last 12 months. In large part because of Chef I was able to roll out over 130 virtual machines in a tiny fraction of the time that it took me to do with my bespoke python and bash scripts.&amp;nbsp;I also rolled out comprehensive monitoring with collectd, statsd, logstash, and graphite for all of my VMs. I simply couldn't have accomplished that without Chef. I still don't have full JVM monitoring but I am working on that.&amp;nbsp;Lastly, Chef has kept my job interesting. I love being a sysadmin but often this job can be tedious. Chef alleviated that tedium to a large extent.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;Lessons Learned&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
So that's what Chef has done for me, but along the way there was a whole lot learning, mistakes, and learning from mistakes. There are many lessons that stick out most in my mind but a couple more than the others.&lt;br /&gt;
&lt;br /&gt;
First off, &lt;a href="https://github.com/reset"&gt;follow Jamie Winsor&lt;/a&gt; on github and &lt;a href="http://vialstudios.com/guide-authoring-cookbooks.html"&gt;follow the workflow&lt;/a&gt; that RiotGames team has come up with. Jamie and company folded many of their best practices in the &lt;a href="http://berkshelf.com/"&gt;Berkshelf&lt;/a&gt; tool. I have experimented with a number of different workflow tools but &lt;i&gt;The Berkshelf Way&lt;/i&gt; works best for me. Jamie wrote up an &lt;a href="http://vialstudios.com/guide-authoring-cookbooks.html"&gt;excellent guide&lt;/a&gt; on how to develop application cookbooks. Read it and live by it. I had already come to some of the same conclusions but many were new to me. I had the pleasure of &lt;a href="http://foodfightshow.org/2012/08/jamie-winsor-and-michael-ivey-skool-us-on-berkshelf.html"&gt;interviewing Jamie&lt;/a&gt; for the &lt;a href="http://foodfightshow.org/"&gt;Food Fight podcast&lt;/a&gt;. If you are into Chef or just curious, you should definitley give a listen.&lt;br /&gt;
&lt;br /&gt;
The next most important lesson that you should really use &lt;a href="http://pryrepl.org/"&gt;pry&lt;/a&gt; in order to learn Ruby and Chef. Pry is an improved read-eval-print-loop for Ruby that will help you inspect, explore, and understand Chef. It is irb on mega-steroids. Pry isn't something you use once you are more advanced with Ruby but rather I recommend pry to learn Ruby from scratch. Go watch Josh Peek's &lt;a href="http://pryrepl.org/screencasts.html"&gt;10-minute intro video&lt;/a&gt; _now_. Debugging a recipe is as easy as inserting &lt;span style="color: blue; font-family: 'Courier New', Courier, monospace;"&gt;require 'pry'; binding.pry&lt;/span&gt; . With pry-nav, you can easily step through your running Chef code.&lt;br /&gt;
&lt;br /&gt;
Here are the rest of my lessons with the ones recommended by the _Berkshelf_Way_ denoted by (BW)&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Roles are bad. Don't use them. Roles make it hard to collaborate on and test cookbooks in a distributed manner. Use a wrapper cookbook instead&amp;nbsp;(BW).&lt;/li&gt;
&lt;li&gt;Use wrapper cookbooks to add information and settings specific to your organization to a more generic cookbook. For example, use a acme-postgres cookbook to override the default values and add corporate-specific policies to the mainline postgresql cookbook (BW).&lt;/li&gt;
&lt;li&gt;Use chef-solo when developing cookbooks even when you will use chef-server to deploy them. It will give you far faster feedback (BW).&lt;/li&gt;
&lt;li&gt;Every cookbook must live in its own git repository.&lt;/li&gt;
&lt;li&gt;Whenever possible, add tests to your cookbooks. It will save your sanity, seriously.&lt;/li&gt;
&lt;li&gt;As a sysadmin, you won't be able to keep your cookbooks up-to-date without getting your developers involved in writing them.&lt;/li&gt;
&lt;li&gt;You can't automate something you don't understand. You can't write a good postgresql cookbook when you know nothing about postgresql. You can write a lousy postgresql cookbook for a learning experience, but throw it away and start fresh once you know what the Hell you're doing.&lt;/li&gt;
&lt;li&gt;Ruby is a lot of fun, see earlier point on pry.&lt;/li&gt;
&lt;li&gt;The amount of instability in gems and the Ruby VM itself often drive me to the brink of insanity. The amount of effort that it takes to get Ruby 1.9.x installed on an arbitrary machine is ridiculous.&lt;/li&gt;
&lt;li&gt;Update your cookbook's version in metadata.rb with every significant change.&lt;/li&gt;
&lt;li&gt;open-source your cookbooks whenever possible. You will get valuable feedback that will improve their quality and make them more secure. Further, interacting with the larger open-source community can vastly improve your skills.&lt;/li&gt;
&lt;li&gt;Follow &lt;a href="https://github.com/acrmp"&gt;Andrew Crump&lt;/a&gt; on Github. He is author of Chefspec, foodcritic, and a key contributor to minitest-chef and test-kitchen.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style="font-size: large;"&gt;What is Needed Now&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
More than anything, Chef needs a comprehensive guide book. I know that Stephen Nelson-Smith is working on the&amp;nbsp;&lt;a href="http://shop.oreilly.com/product/0636920025146.do"&gt;Definitive Guide to Chef&lt;/a&gt;. Unfortunately, the release date for that book is uncertain. James Turnbull and Jeff McCune did a kickass job with&amp;nbsp;&lt;a href="http://www.apress.com/9781430230571"&gt;Pro Puppet&lt;/a&gt;&amp;nbsp;and Chef desperately needs the equivalent.&lt;br /&gt;
&lt;br /&gt;
Here are some additional things that are needed:&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;We need a lightweight orchestration tool that &amp;nbsp;works when managing several vagrant vms and to deploy a cluster on vmware. Rake tasks don't cut it and Apache Zookeeper is definitely not lightweight.&lt;/li&gt;
&lt;li&gt;Some kind of maintainership program, culture, or outright cult to encourage people to maintain cookbooks for a variety of operating systems.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Better testing tooling. Test-kitchen is a good step but much more remains to be done such as better integration with Continuous Integration systems and support for Berkshelf.&lt;/li&gt;
&lt;li&gt;Make it easier for newbies to get started w/ Ruby. &amp;nbsp;This is the biggest hurdle for newbies. ruby 1.9 is easy to work w/ _once_ you get it installed. It really needs to be as easy as &amp;nbsp;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sudo apt-get install -y ruby19&lt;/span&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;Chef Compared to Ansible, Pallet, and Salt Stack&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
I did write up a &lt;a href="http://devopsanywhere.blogspot.it/2011/10/puppet-vs-chef-fight.html"&gt;detailed comparison&lt;/a&gt; with Puppet but I have not given newer frameworks such as ansible, saltstack, and pallet the attention they deserve. Nor have I done a proper analysis of CFEngine 3. I have been remiss in that, &lt;i&gt;mea culpa&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;In Summary&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The Chef tool and community are far more mature than they were 12 months ago. I expect to see exponential growth in the community and use of Chef itself. The hardest part of working with Chef is managing to keep up with the rapid pace of development and community contributions. Luckily, Nathen Harvey does a fantastic job of summing up the latest developments with his What's Cooking segment on the &lt;a href="http://foodfightshow.org/"&gt;Food Fight Show&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
To wrap up, the best thing about working with Chef for 12 months is that it has made me a better sysadmin.&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/Devopsanywhere/~4/CfRQXpTQhB8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://devopsanywhere.blogspot.com/feeds/1669157846509750690/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://devopsanywhere.blogspot.com/2012/10/a-year-with-chef.html#comment-form" title="9 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/1669157846509750690?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/1669157846509750690?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Devopsanywhere/~3/CfRQXpTQhB8/a-year-with-chef.html" title="A Year with Chef" /><author><name>Bryan Berry</name><uri>https://plus.google.com/106664679333642993534</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-TyULMG7ZA6A/AAAAAAAAAAI/AAAAAAAAAAA/wjGutwhuhAU/s512-c/photo.jpg" /></author><thr:total>9</thr:total><feedburner:origLink>http://devopsanywhere.blogspot.com/2012/10/a-year-with-chef.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE8HR349fyp7ImA9WhBTGEk.&quot;"><id>tag:blogger.com,1999:blog-1083699665345453745.post-3222382105443439928</id><published>2012-07-02T00:25:00.004-07:00</published><updated>2013-02-14T05:00:36.067-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-14T05:00:36.067-08:00</app:edited><title>Stash those logs! Set up Logstash quickly with Chef + Berkshelf</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;I have been spending a lot of time lately with the excellent&amp;nbsp;&lt;/span&gt;&lt;a href="http://logstash.net/" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; outline: none; text-decoration: none;"&gt;logstash&lt;/a&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;&amp;nbsp;tool. If you aren't familiar with logstash, it reads your logs files, can optionally filter and transform them, and can send them somewhere else for arbitrary purposes. Setting up logstash can be a bit complicated, especially once you add in&amp;nbsp;&lt;/span&gt;&lt;a href="http://www.elasticsearch.org/" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; outline: none; text-decoration: none;"&gt;elasticsearch&lt;/a&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;&amp;nbsp;as the backend. Luckily, there are some great chef cookbooks, from&amp;nbsp;&lt;/span&gt;&lt;a href="https://github.com/karmi" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; outline: none; text-decoration: none;"&gt;Karel Minarik&lt;/a&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;&amp;nbsp;and&amp;nbsp;&lt;/span&gt;&lt;a href="https://github.com/lusis" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; outline: none; text-decoration: none;"&gt;John E. Vincent&lt;/a&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;, for both elasticsearch and logstash. I have extended both cookbooks for my purposes, with pull requests pending as of this writing.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;I use logstash to monitor my&amp;nbsp;&lt;/span&gt;&lt;a href="http://haproxy.1wt.eu/" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; outline: none; text-decoration: none;"&gt;haproxy&lt;/a&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;&amp;nbsp;front-end servers. Call me crazy but I like haproxy so much that I even use it do all of my front-end URL rewriting and redirects rather than using a more traditional tool like Apache or Nginx. At this time I only use Apache for my SSL termination. All actual HTTP serving is done by backend java application servers. Haproxy is in my humble opinion, more flexible, easier to configure, more performant than Apache except for one area. It is very easy to make apache send different kinds of logging information to separate log files. Haproxy sends all of its logging information to syslog and its up to you to break it apart. Enter logstash. As the great Lusis describes logstash.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class="tr_bq" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;
&lt;i style="-webkit-animation: 0 !important; -webkit-transition: none !important;"&gt;Stuff comes in&lt;/i&gt;&lt;br /&gt;
&lt;i style="-webkit-animation: 0 !important; -webkit-transition: none !important;"&gt;Bits get Twiddled&lt;/i&gt;&lt;br /&gt;
&lt;i style="-webkit-animation: 0 !important; -webkit-transition: none !important;"&gt;Stuff comes out&lt;/i&gt;&lt;/blockquote&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;For a good introduction to logstash, I recommend Lusis&amp;nbsp;&lt;/span&gt;&lt;a href="https://speakerdeck.com/u/lusis/p/logging-patterns-with-logstash-and-chef" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; outline: none; text-decoration: none;"&gt;slides from Chefconf&lt;/a&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;. I will only cover my immediate use case here. I need to add a logstash agent on each haproxy that sends them to a central logstash server that aggregates all the logs and makes them searchable by injecting them into elasticsearch.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;Here is the basic configuration for the logstash agent on my haproxy servers&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/3018569.js?file=file-shipper-conf"&gt;&lt;/script&gt;

&lt;div class="gistLoad" data-id="3018569" id="gist-3018569"&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;As you can problably intuit from shipper.conf, it reads from the haproxy.log file and sends it off to my main logstash_server using AMQP. I actually could read directly from syslog rather than the file. I just haven't gotten around to doing that yet. Then on my logstash_server I have the following configuration:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;To actually install the agent on my haproxy server, I just add the Chef recipe&amp;nbsp;&lt;/span&gt;&lt;a href="https://github.com/bryanwb/chef-logstash/blob/master/recipes/agent.rb" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; outline: none; text-decoration: none;"&gt;logstash::agent&lt;/a&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;&amp;nbsp;to the run_list of my haproxy role, add a few attributes to the same haproxy role and voila! the agent is shipping logs. On the logstash server side, I add the following to my node's run_list plus a few odd attributes&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Courier New', Courier, monospace; font-size: 14px; line-height: 19px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; "role[elasticsearch_server]", &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Courier New', Courier, monospace; font-size: 14px; line-height: 19px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"recipe[logstash::server]", &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Courier New', Courier, monospace; font-size: 14px; line-height: 19px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"recipe[logstash::kibana]", &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Courier New', Courier, monospace; font-size: 14px; line-height: 19px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"recipe[logstash::haproxy]" &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;After my next node convergence you will see a pretty picture like this&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;img height="345" src="http://rashidkpc.github.com/Kibana/images/screenshots/searchss.png" style="-webkit-animation: 0ms !important; -webkit-border-image: url(data:image/png; -webkit-transition: none !important; border-image-repeat: stretch; border-image-slice: 9; border-image-source: url(data:image/png; border-image-width: 9px; border: 9px none; box-sizing: border-box; color: #333333; display: inline-block; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; height: auto; line-height: 19px; margin: 10px auto; max-width: 100%; padding: 8px;" width="640" /&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;Wow! This is the excellent&amp;nbsp;&lt;/span&gt;&lt;a href="https://github.com/rashidkpc/Kibana" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; outline: none; text-decoration: none;"&gt;Kibana&lt;/a&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;&amp;nbsp;interface created by&amp;nbsp;&lt;/span&gt;&lt;a href="https://github.com/rashidkpc" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; outline: none; text-decoration: none;"&gt;Rashid Khan&lt;/a&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;. You may have realized that it is a little more complicated to put this together than I have let on. &amp;nbsp;Let me walk you down the steps of how I actually put it together. But first let's be clear what is happening here&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;1. Logstash agent on each haproxy server reads the log files and ships each individual entry over AMQP to the logstash_server&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;2. A rabbitmq-server on logstash_server receives the amqp messages and passes them to the logstash server&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;3. The logstash_server `groks` each entry, i.e. it parses the entry and labels named fields according to a pattern, in this case the HAPROXYHTTP&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;4. logstash_server puts the grokked log entries into elasticsearch so that they are searchable&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;5. You can use the pretty kibana interface to watch a live stream of log entries or query by any `grokked` field. Kibana queries elasticsearch directly using&amp;nbsp;&lt;/span&gt;&lt;a href="https://lucene.apache.org/core/old_versioned_docs/versions/3_5_0/queryparsersyntax.html" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; outline: none; text-decoration: none;"&gt;Lucene query syntax&lt;/a&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;. It does not talk directly to the logstash_server.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;As you can see, that's a lot of moving parts! Each moving part requires its own Chef cookbook. This ends up being quite a lot of cookbooks to manage. Enter&amp;nbsp;&lt;/span&gt;&lt;a href="http://berkshelf.com/" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; outline: none; text-decoration: none;"&gt;Berkshelf&lt;/a&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;, an excellent tool for managing cookbooks, written by the great team at&amp;nbsp;&lt;/span&gt;&lt;a href="http://riotgames.com/" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; outline: none; text-decoration: none;"&gt;Riot Games&lt;/a&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;. We will use Berkshelf to do much of the heavy lifting for us. I will walk you through how to use berkshelf together with chef-solo to set up logstash.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;Before we move on, you should know about the other "moving part" that everybody talks about, the awesome&lt;/span&gt;&lt;a href="http://graphite.wikidot.com/" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; outline: none; text-decoration: none;"&gt;Graphite&lt;/a&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;. Many, many people use logstash to glean metrics from log files and send information on to Graphite where it becomes pretty graphs. This is also a large part of Lusis aforementioned&amp;nbsp;&lt;/span&gt;&lt;a href="https://speakerdeck.com/u/lusis/p/logging-patterns-with-logstash-and-chef" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; outline: none; text-decoration: none;"&gt;presentation&lt;/a&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;. Unfortunately, I haven't started with Graphite yet but once I do I will have another juicy blog post to share with you.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: medium;"&gt;Setting up Berkshelf&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #333333; font-family: Helvetica Neue Light, HelveticaNeue-Light, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 19px;"&gt;It used to be a bit difficult to install Berkshelf, but now it couldn't be easier&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Helvetica Neue Light, HelveticaNeue-Light, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Courier New', Courier, monospace; font-size: 14px; line-height: 19px;"&gt;&amp;nbsp;&amp;nbsp;$ &amp;nbsp;gem install berkshelf&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: medium;"&gt;How Berkshelf Works&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;Simply insert the following at the top of your Vagrantfile and Berkshelf will ensure that your cookbooks are uploaded to your vagrant VM&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="color: #333333; font-family: Helvetica Neue Light, HelveticaNeue-Light, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 19px;"&gt;&lt;i&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/i&gt;require 'berkshelf/vagrant'&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #333333; font-family: Helvetica Neue Light, HelveticaNeue-Light, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 19px;"&gt;To upload your cookbooks specified in your Berksfile to your chef-server, do the following&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Helvetica Neue Light, HelveticaNeue-Light, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 19px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Helvetica Neue Light, HelveticaNeue-Light, Helvetica Neue, Helvetica, Arial, sans-serif;"&gt;&lt;span style="font-size: 14px; line-height: 19px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; $ berks upload&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;This Berksfile instantly gives your team a mechanism to work off the same set of cookbooks. Back in the dark ages of Chef, Oh 9 months ago, we all kept our cookbooks bunched together in a single git repository. This caused all kinds of &amp;nbsp;headaches if you actually wanted to push your changes to an individual cookbook back to Opscode or to someone else. Some months ago, Joshua Timberman split the monolithic&amp;nbsp;&lt;/span&gt;&lt;a href="https://github.com/opscode/cookbooks" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; outline: none; text-decoration: none;"&gt;https://github.com/opscode/cookbooks&lt;/a&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;&amp;nbsp;repository out into&amp;nbsp;&lt;/span&gt;&lt;a href="https://github.com/opscode-cookbooks" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; outline: none; text-decoration: none;"&gt;individual git repositories&lt;/a&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;. This has made it a million times easier to collaborate on cookbooks but much harder to work on a common set within a team.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;This scenario shows how Berkshelf can help a team collaborate on common set of cookbooks but we will use berkshelf for a different purpose. When working on a cookbook or set of cookbooks for an application, we don't need all of the cookbooks in the our top-level Berksfile at&amp;nbsp;&lt;/span&gt;&lt;i style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;~/chef-repo/Berksfile.&amp;nbsp;&lt;/i&gt;&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; background-color: white; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;Further, we may be collaborating with people outside your organization who don't need or want to see all your corporate cookbooks. For ease of development, each cookbook needs a description of its dependencies. For this reason we will also have a Berksfile for the logstash cookbook that describes its dependencies.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;Here is my Berksfile for logstash.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/3019171.js?file=Berksfile"&gt;&lt;/script&gt;

&lt;br /&gt;
&lt;div class="gistLoad" data-id="3019171" id="gist-3019171"&gt;
Loading ....&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: medium;"&gt;Let's Get this Show on the Road!&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;Too much talking, let's get some work done. First, clone my chef-logstash repository.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Courier New', Courier, monospace; font-size: 14px; line-height: 19px;"&gt;$ cd ~/projects/&lt;/span&gt;&lt;br /&gt;
&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Courier New', Courier, monospace; font-size: 14px; line-height: 19px;"&gt;$ git clone&amp;nbsp;git://github.com/lusis/chef-logstash.git &amp;nbsp;logstash&lt;/span&gt;&lt;br /&gt;
&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Courier New', Courier, monospace; font-size: 14px; line-height: 19px;"&gt;$ cd logstash&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: red; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;It is critical that you clone the repository as&amp;nbsp;&lt;b style="-webkit-animation: 0 !important; -webkit-transition: none !important;"&gt;logstash&lt;/b&gt;&amp;nbsp;and not the default chef-logstash. Otherwise you will get a cryptic error message later on.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;Next, let's fire up a vagrant VM using the Vagrant definitions that come with the logstash cookbook. I am assuming here that you are already familiar with Vagrant but if you are not, check it out&amp;nbsp;&lt;/span&gt;&lt;a href="http://vagrantup.com/" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; outline: none; text-decoration: none;"&gt;here&lt;/a&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Courier New', Courier, monospace; font-size: 14px; line-height: 19px;"&gt;$ vagrant up lucid32&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;I also have included vagrant definitions for 64-bit Lucid and CentOS 32-bit.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;This will take a while. Vagrant will fetch a vagrant box for 32-bit Ubuntu Lucid and then apply a set the set of Chef recipes to set up logstash. You should also see the result of some integration tests I have written for the elasticsearch cookbook using the&amp;nbsp;&lt;/span&gt;&lt;a href="https://github.com/btm/minitest-handler-cookbook" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; outline: none; text-decoration: none;"&gt;minitest-handler&lt;/a&gt;&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;"&gt;You should see at the end of the run the output from the integration tests.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Courier New', Courier, monospace; font-size: 14px; line-height: 19px;"&gt;Finished tests in 8.395664s, 0.4764 tests/s, 0.4764 assertions/s.&lt;/span&gt;&lt;br /&gt;
&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Courier New', Courier, monospace; font-size: 14px; line-height: 19px;"&gt;&lt;br style="-webkit-animation: 0 !important; -webkit-transition: none !important;" /&gt;&lt;/span&gt;
&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Courier New', Courier, monospace; font-size: 14px; line-height: 19px;"&gt;4 tests, 4 assertions, 0 failures, 0 errors, 0 skips&lt;/span&gt;&lt;br /&gt;
&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Courier New', Courier, monospace; font-size: 14px; line-height: 19px;"&gt;[Mon, 02 Jul 2012 08:17:03 +0200] INFO: Report handlers complete&lt;/span&gt;&lt;br /&gt;
&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Courier New', Courier, monospace; font-size: 14px; line-height: 19px;"&gt;[Mon, 02 Jul 2012 08:17:03 +0200] DEBUG: Exiting&lt;/span&gt;&lt;br /&gt;
&lt;div style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; margin: 0px; outline: none; padding: 0px;"&gt;
&lt;br style="-webkit-animation: 0 !important; -webkit-transition: none !important;" /&gt;&lt;/div&gt;
&lt;div style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; margin: 0px; outline: none; padding: 0px;"&gt;
You may also see the a bunch of invocations of the `curl` command in red. The integration tests use curl extensively and curl outputs its progress to stderr. You can disregard those.&lt;/div&gt;
&lt;div style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; margin: 0px; outline: none; padding: 0px;"&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; margin: 0px; outline: none; padding: 0px;"&gt;
Next, fire up a web browser with the using the IP address of your vagrant VM, something like http://192.168.2.x. &amp;nbsp;POW! There is&amp;nbsp;&lt;a href="https://github.com/rashidkpc/Kibana" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; outline: none; text-decoration: none;"&gt;Kibana&lt;/a&gt;, the wonderful web interface for Logstash created by&amp;nbsp;&lt;a href="https://github.com/rashidkpc" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; outline: none; text-decoration: none;"&gt;Rashid Khan&lt;/a&gt;. No logs are displayed as we haven't yet put any data into logstash.&lt;/div&gt;
&lt;div style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; margin: 0px; outline: none; padding: 0px;"&gt;
&lt;br style="-webkit-animation: 0 !important; -webkit-transition: none !important;" /&gt;&lt;/div&gt;
&lt;div class="separator" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; clear: both; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; margin: 0px; outline: none; padding: 0px; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/--U4TRlBkNp0/T_FEh4AABYI/AAAAAAAAEtA/8yBrhUGTm1k/s1600/kibana.jpg" imageanchor="1" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; margin-bottom: 0px !important; margin-left: 1em; margin-right: 1em; margin-top: 0px !important; outline: none; text-decoration: none;"&gt;&lt;img border="0" height="251" src="http://4.bp.blogspot.com/--U4TRlBkNp0/T_FEh4AABYI/AAAAAAAAEtA/8yBrhUGTm1k/s640/kibana.jpg" style="-webkit-animation: 0 !important; -webkit-border-image: url(data:image/png; -webkit-transition: none !important; border-image-repeat: stretch; border-image-slice: 9; border-image-source: url(data:image/png; border-image-width: 9px; border: 9px none; box-sizing: border-box; display: inline-block; height: auto; margin: 10px auto; max-width: 100%; padding: 8px; position: relative;" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; margin: 0px; outline: none; padding: 0px;"&gt;
Lets go into more detail about how the logstash cookbook works. The main logstash configuration file consists of what are essentially ruby hashes.&lt;/div&gt;
&lt;div style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; margin: 0px; outline: none; padding: 0px;"&gt;
&lt;br style="-webkit-animation: 0 !important; -webkit-transition: none !important;" /&gt;&lt;/div&gt;
&lt;div style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; margin: 0px; outline: none; padding: 0px;"&gt;
Here is a sample logstash server configuration&lt;/div&gt;
&lt;div style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; margin: 0px; outline: none; padding: 0px;"&gt;
&lt;br style="-webkit-animation: 0 !important; -webkit-transition: none !important;" /&gt;&lt;/div&gt;
&lt;script src="https://gist.github.com/3031605.js?file=gistfile1.txt"&gt;&lt;/script&gt;

&lt;br /&gt;
&lt;div class="gistLoad" data-id="3031605" id="gist-3031605"&gt;
Loading ....&lt;/div&gt;
&lt;div style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px; margin: 0px; outline: none; padding: 0px;"&gt;
&lt;br /&gt;
&lt;div style="-webkit-animation: 0 !important; -webkit-transition: none !important; margin: 0px; outline: none; padding: 0px;"&gt;
&lt;br style="-webkit-animation: 0 !important; -webkit-transition: none !important;" /&gt;&lt;/div&gt;
&lt;div style="-webkit-animation: 0 !important; -webkit-transition: none !important; margin: 0px; outline: none; padding: 0px;"&gt;
Instead of writing an&amp;nbsp;&lt;a href="http://wiki.opscode.com/display/chef/Opscode+LWRP+Resources" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; outline: none; text-decoration: none;"&gt;LWRP&lt;/a&gt;&amp;nbsp;for logstash. I make it very easy to template the the logstash configuration using attributes provided by a role or a node. Here is a sample role for configuring a logstash_server that matches the previous logstash.conf file.&lt;/div&gt;
&lt;div style="-webkit-animation: 0 !important; -webkit-transition: none !important; margin: 0px; outline: none; padding: 0px;"&gt;
&lt;br style="-webkit-animation: 0 !important; -webkit-transition: none !important;" /&gt;&lt;/div&gt;
&lt;div style="-webkit-animation: 0 !important; -webkit-transition: none !important; margin: 0px; outline: none; padding: 0px;"&gt;
&lt;/div&gt;
&lt;div style="-webkit-animation: 0 !important; -webkit-transition: none !important; margin: 0px; outline: none; padding: 0px;"&gt;
&lt;br style="-webkit-animation: 0 !important; -webkit-transition: none !important;" /&gt;&lt;/div&gt;
&lt;script src="https://gist.github.com/3031583.js?file=logstash_server.rb"&gt;&lt;/script&gt;

&lt;br /&gt;
&lt;div class="gistLoad" data-id="3031583" id="gist-3031583"&gt;
Loading ....&lt;/div&gt;
&lt;div style="-webkit-animation: 0 !important; -webkit-transition: none !important; margin: 0px; outline: none; padding: 0px;"&gt;
&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; background-color: white;"&gt;All you have to do is provide a ruby hash and the logstash templates will render them them into logstash configurations. There are more details in the&amp;nbsp;&lt;a href="https://github.com/bryanwb/chef-logstash/blob/master/README.md" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; outline: none; text-decoration: none;"&gt;README&lt;/a&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; background-color: white;"&gt;&lt;br style="-webkit-animation: 0 !important; -webkit-transition: none !important;" /&gt;&lt;/span&gt;
&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; background-color: white;"&gt;There is a lot more to the awesome&amp;nbsp;&lt;/span&gt;&lt;a href="http://logstash.net/" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; background-color: white; color: #009eb8; display: inline; outline: none; text-decoration: none;"&gt;logstash&lt;/a&gt;&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; background-color: white;"&gt;&amp;nbsp;and its underlying dependencies like&amp;nbsp;&lt;/span&gt;&lt;a href="http://www.elasticsearch.org/" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; background-color: white; color: #009eb8; display: inline; outline: none; text-decoration: none;"&gt;elasticsearch&lt;/a&gt;&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; background-color: white;"&gt;. &amp;nbsp;Even if you are not looking to implement logstash any time soon, you should seriously take a look at using&amp;nbsp;&lt;a href="http://berkshelf.com/" style="-webkit-animation: 0ms !important; -webkit-transition: none !important; color: #009eb8; display: inline; outline: none; text-decoration: none;"&gt;Berkshelf&lt;/a&gt;&amp;nbsp;for managing your cookbook dependencies. Let's hope I find time in the next month to write about Logstash + Graphite.&lt;/span&gt;&lt;/div&gt;
&lt;div style="-webkit-animation: 0 !important; -webkit-transition: none !important; margin: 0px; outline: none; padding: 0px;"&gt;
&lt;span style="-webkit-animation: 0ms !important; -webkit-transition: none !important; background-color: white;"&gt;&lt;br style="-webkit-animation: 0 !important; -webkit-transition: none !important;" /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="-webkit-animation: 0 !important; -webkit-transition: none !important; margin: 0px; outline: none; padding: 0px;"&gt;
P.S. Thanks to Jamie Winsor (Berkshelf) and Karel Minarik (elasticsearch) for their assistance in working with their respective projects.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;script src="https://raw.github.com/moski/gist-Blogger/master/public/gistLoader.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/Devopsanywhere/~4/_AzpbPzIsPY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://devopsanywhere.blogspot.com/feeds/3222382105443439928/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://devopsanywhere.blogspot.com/2012/07/stash-those-logs-set-up-logstash.html#comment-form" title="8 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/3222382105443439928?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/3222382105443439928?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Devopsanywhere/~3/_AzpbPzIsPY/stash-those-logs-set-up-logstash.html" title="Stash those logs! Set up Logstash quickly with Chef + Berkshelf" /><author><name>Bryan Berry</name><uri>https://plus.google.com/106664679333642993534</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-TyULMG7ZA6A/AAAAAAAAAAI/AAAAAAAAAAA/wjGutwhuhAU/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/--U4TRlBkNp0/T_FEh4AABYI/AAAAAAAAEtA/8yBrhUGTm1k/s72-c/kibana.jpg" height="72" width="72" /><thr:total>8</thr:total><feedburner:origLink>http://devopsanywhere.blogspot.com/2012/07/stash-those-logs-set-up-logstash.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUIEQH4yfip7ImA9WhNWE08.&quot;"><id>tag:blogger.com,1999:blog-1083699665345453745.post-8574806147870272493</id><published>2012-04-30T00:18:00.002-07:00</published><updated>2012-12-12T07:51:41.096-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-12T07:51:41.096-08:00</app:edited><title>Real Tests, Real Simple with Minitest, Vagrant, and Toft</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
I have put a lot of work into my Ark cookbook lately and it has grown to such complexity that it my existing set of workflow and tools were not enough. I needed some way to sanity check my code. I needed tests.&lt;br /&gt;
&lt;br /&gt;
You can't refactor with confidence without tests. I have fully rewritten ark several times already. After making serious changes, I then had to spend roughly 20 minutes manually testing the cookbook to ensure that &amp;nbsp;it still worked the way I intended it to. This manual testing was getting tedious, really tedious.&lt;br /&gt;
&lt;br /&gt;
Looking at my various options, I first took a look at Cucumber. There are some nice tools out there like simple_cuke, cuken, and ironfan-ci. I made some attempts at using simple_cuke but they failed fairly miserably. That's because I thought I could use Cucumber without having to actually learn it. Cucumber is &amp;nbsp;a powerful and somewhat complex tool. To benefit from using Cucumber, I was really going to have to read the The Cucumber Book, something I don't have time for right now. I needed the simplest thing that could possibly work. Further, the real benefit of Cucumber appears to be the communication it facilitates between customer and engineer. In this case I am the client and the extra layer of communication is unnecessary.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Enter MiniTest&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Luckily for me, BTM and Andrew Crump have been doing &lt;a href="https://github.com/btm/minitest-handler-cookbook"&gt;great work&lt;/a&gt; adapting David Calavera's chef-minitest-handler&amp;nbsp;https://github.com/calavera/minitest-chef-handler. MiniTest is the simplest thing that could possibly work. It works by gathering all the files that match the path &amp;nbsp;files/default/tests/minitest/*_test.rb for the cookbooks in your run_list into /var/chef/minitest/. Once your regular chef run completes, the minitest-handler cookbook executes each of those tests and displays the results.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note:&lt;/b&gt; As of 30 April, 2012 there is a &lt;a href="https://github.com/btm/minitest-handler-cookbook/issues/6"&gt;known bug&lt;/a&gt; in minitest-handler that requires you run chef-client twice in a row for the tests to actually execute.&lt;br /&gt;
&lt;b&gt;Update:&lt;/b&gt;&amp;nbsp;&amp;nbsp;Set the network type to bridged and you won't have this problem &lt;span style="background-color: lime;"&gt;config.vm.network :bridged&lt;/span&gt; &amp;nbsp; &lt;br /&gt;
&lt;div&gt;
However, running in bridged mode may require sudo.&lt;/div&gt;
&lt;br /&gt;
My ark cookbook is really just an LWRP. The default recipe does nothing more than install the unzip package on those *nix distributions that don't have it by default. I created an ark::test recipe that exercises all of the features of the ark resource. Here is a snippet of it.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="https://github.com/bryanwb/chef-ark/blob/master/recipes/test.rb"&gt;ark/recipes/test.rb&lt;/a&gt;&lt;br /&gt;
&lt;script src="https://gist.github.com/2555849.js"&gt;
&lt;/script&gt;
&lt;div class="gistLoad" data-id="2555849" id="gist-2555849"&gt;Loading ....&lt;/div&gt;

Next, &amp;nbsp;I have my actual MiniTest tests classes, scoped according to my recipe "test"&lt;br /&gt;
&lt;br /&gt;
&lt;a href="https://github.com/bryanwb/chef-ark/blob/master/files/default/tests/minitest/ark_cherry_pick_test.rb"&gt;ark/files/default/tests/minitest/ark_test.rb&lt;/a&gt;&lt;br /&gt;
&lt;script src="https://gist.github.com/2555851.js?file=ark_cherry_pick_test.rb"&gt;

&lt;/script&gt;
&lt;div class="gistLoad" data-id="2555851" id="gist-2555851"&gt;Loading ....&lt;/div&gt;

To run these tests I have to first add &lt;a href="https://github.com/opscode-cookbooks/chef_handler"&gt;chef_handler&lt;/a&gt; and &lt;a href="https://github.com/btm/minitest-handler-cookbook"&gt;minitest-handler&lt;/a&gt; to the beginning of my run_list. Note that the minitest-handler-cookbook doesn't yet support chef-solo, but I &lt;a href="https://github.com/bryanwb/minitest-handler-cookbook"&gt;patched it&lt;/a&gt; over the weekend so that it does.&lt;br /&gt;
&lt;br /&gt;
Here is what the output of the tests looks like&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-3wwQwFMfT9s/T542pThQNBI/AAAAAAAAEbY/Gg9sFeSp-ZA/s1600/minitest-run.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="433" src="http://4.bp.blogspot.com/-3wwQwFMfT9s/T542pThQNBI/AAAAAAAAEbY/Gg9sFeSp-ZA/s640/minitest-run.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
I originally wrote my tests using MiniTest::Unit test cases. However, just a few days ago I discovered the awesomeness that Andrew Crump has built into MiniTest::Spec and a whole set of helper modules that really simplify the code you have to write.&lt;br /&gt;
&lt;br /&gt;
Here is a snippet to test whether a file exists and has the correct owner&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/2555888.js"&gt;

&lt;/script&gt;
&lt;div class="gistLoad" data-id="2555888" id="gist-2555888"&gt;Loading ....&lt;/div&gt;

I especially love all of the resource matchers that let you connect to the actual resource objects created during your Chef run and to check whether their configuration matches the actual system state.&lt;br /&gt;
&lt;br /&gt;
For some detailed examples, check out this &lt;a href="https://github.com/calavera/minitest-chef-handler/blob/v0.4.0/examples/spec_examples/files/default/tests/minitest/example_test.rb"&gt;example&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;The Not so Simple Part&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Ok, that was the easy part. The harder part is to run your tests on a clean environment. You need a relatively fresh VM to ensure that the tests are actually testing changes made by your cookbook and not some change made eons ago for another purpose. The simplest tool for this is &lt;a href="http://vagrantup.com/"&gt;Vagrant&lt;/a&gt;. Here is the &lt;a href="https://github.com/bryanwb/chef-ark/blob/master/Vagrantfile"&gt;Vagrantfile&lt;/a&gt; I use to test the ark cookbook.&lt;br /&gt;
&lt;script src="https://gist.github.com/2555902.js?file=Vagrantfile"&gt;
&lt;/script&gt;
&lt;div class="gistLoad" data-id="2555902" id="gist-2555902"&gt;Loading ....&lt;/div&gt;

&lt;br /&gt;
Here are the commands you run to provision your new server using vagrant
&lt;br /&gt;

&lt;script src="https://gist.github.com/2555919.js?file=commands.sh"&gt;
&lt;/script&gt;
&lt;div class="gistLoad" data-id="2555919" id="gist-2555919"&gt;Loading ....&lt;/div&gt;
 

&lt;br /&gt;
&lt;br /&gt;
Note when using Vagrant that bridging your VM's network to your wireless network connection is not a straightforward process, at least not on my linux laptop. If you run linux as your primary OS, I recommend you spare yourself the pain of trying to bridge your VM to wlan0 and just stick an Ethernet cable into your laptop.&lt;br /&gt;
&lt;br /&gt;
While Vagrant is an awesome tool it is not the best tool for all situations. One issue I have is that my corporate workstation is a very locked down Windows Vista installation. I do virtually all of my work within an Ubuntu virtual machine running on top of Virtualbox. Vagrant uses virtualbox to create new virtual machines and there is no mechanism to run virtualbox within virtualbox. Earlier this year I attempted to get ruby and vagrant running on Windows Vista but after 4 hours I didn't even have ruby running on Vista.&lt;br /&gt;
&lt;br /&gt;
Another issue with Virtualbox is that it's flexibility comes at a cost. Virtualbox runs entirely in userspace which means it is less performant than other virtualization tools such as KVM and &lt;a href="http://lxc.sourceforge.net/"&gt;linux containers&lt;/a&gt; (LXC). This performance lag could become very noticeable once you try to spin up a 4-node postgresql cluster. Of the three virtualization technologies mentioned here, LXC adds the least overhead as each container shares the same copy of the running kernel. There may be other optimizations that LXC provides which I am not aware of.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Enter LXC and Toft&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
As mentioned earlier, LXC has the least overhead of the other virtualization technologies available. &lt;a href="http://exceedhl.github.com/toft/"&gt;Toft&lt;/a&gt; is a ruby library for testing chef and puppet cookbooks using LXC containers. Toft has a beautiful interface for working with containers as you can see in the following code. &lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/2556111.js?file=Toftfile"&gt;
&lt;div class="gistLoad" data-id="2556111" id="gist-2556111"&gt;Loading ....&lt;/div&gt;
&lt;/script&gt;

I can easily see spinning up a multi-node cluster with toft, running my tests, then destroying the whole setup.&lt;br /&gt;
&lt;br /&gt;
While toft has an excellent interface it is a young project with some rough edges, some of which have more to do with LXC than the toft library itself. To get started with toft, there are some nice guides on the &amp;nbsp;&lt;a href="https://github.com/exceedhl/toft/wiki"&gt;project wiki&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
I very unpleasantly discovered that the version of the cgroup-lite package for Ubuntu 11.10 installed with LXC &lt;b&gt;will make your system unbootable&lt;/b&gt;. The solution is to install cgroup-lite from the oneiric-proposed repository.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/2556136.js?file=gistfile1.txt"&gt;
&lt;/script&gt;
&lt;div class="gistLoad" data-id="2556136" id="gist-2556136"&gt;Loading ....&lt;/div&gt;

&lt;br /&gt;
Another pitfall is that the bind9 and dhcpd servers installed along with LXC will report erroneous information after initial installation. The fix is easy. Run the `lxc-prepare-host` command and you will be in business.&lt;br /&gt;
&lt;br /&gt;
Finally, at this time Toft only works with Ruby 1.8.7 and does not support Ruby 1.9.*&lt;br /&gt;
&lt;br /&gt;
As noted in the Vagrant section, I highly recommend connecting your laptop to Ethernet if your primary OS is Linux.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Summary&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Testing is an exciting and increasing critical part of developing infrastructure. While the existing tools need some polish, you can get a lot done with them. The linkbait title of this post is a bit disingenous. Testing w/ minitest is a breeze, but using vagrant and toft are not straightforward affairs. Toft, in particular, is extremely promising and worthy of your attention. It is extremely well-suited to many of the usecases that Vagrant is not.&lt;/div&gt;
&lt;script src="https://raw.github.com/moski/gist-Blogger/master/public/gistLoader.js" type="text/javascript"&gt;&lt;/script&gt;&lt;img src="http://feeds.feedburner.com/~r/Devopsanywhere/~4/knNkXxrHuh0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://devopsanywhere.blogspot.com/feeds/8574806147870272493/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://devopsanywhere.blogspot.com/2012/04/real-tests-real-simple-with-minitest.html#comment-form" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/8574806147870272493?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/8574806147870272493?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Devopsanywhere/~3/knNkXxrHuh0/real-tests-real-simple-with-minitest.html" title="Real Tests, Real Simple with Minitest, Vagrant, and Toft" /><author><name>Bryan Berry</name><uri>https://plus.google.com/106664679333642993534</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-TyULMG7ZA6A/AAAAAAAAAAI/AAAAAAAAAAA/wjGutwhuhAU/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-3wwQwFMfT9s/T542pThQNBI/AAAAAAAAEbY/Gg9sFeSp-ZA/s72-c/minitest-run.png" height="72" width="72" /><thr:total>5</thr:total><feedburner:origLink>http://devopsanywhere.blogspot.com/2012/04/real-tests-real-simple-with-minitest.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkcMQHs8eyp7ImA9WhVXE0Q.&quot;"><id>tag:blogger.com,1999:blog-1083699665345453745.post-2306787837364988551</id><published>2012-03-21T01:36:00.001-07:00</published><updated>2012-04-14T03:08:01.573-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-04-14T03:08:01.573-07:00</app:edited><title>Unpacking and Installing from Archives with the Ark Resource</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;b&gt;Updated 14 April 2012: The ark API has changed!&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;The ark_put, ark_dump, ark_cherry_pick have been rolled into the main ark library as the actions :put, :dump, and :cherry_pick. Please see the updated &lt;a href="https://github.com/bryanwb/chef-ark"&gt;README&lt;/a&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
There are many wheels that sysadmins reinvent but the one I see reinvented most frequently is the unpacking of a tarball and placing its contents in an arbitrary location. This task seems trivial but there are many slight variations but critical variations to handle. Most chef users resorts to a combination of remote_file, bash, and link resources. This gets the job done but it is a lot of boilerplate for an essentially simple task and it is ridiculously easy to inject errors. I first wrote the &lt;a href="https://github.com/bryanwb/cookbooks/tree/master/java"&gt;java_ark&lt;/a&gt; Lightweight Resource Provider to handle this. Then I discovered Infochimps excellent &lt;a href="https://github.com/infochimps-labs/ironfan-pantry/tree/master/cookbooks/install_from"&gt;install_from_release&lt;/a&gt; LWRP.&lt;br /&gt;
&lt;br /&gt;
Unfortunately, install_from_release did not do everything I need so I had to extend it further. In the process of extending install_from_release, I mangled Infochimps beautiful code into an unworkable mess. I have now refactored that mess into something that is more maintainable and extensible. Please meet the &lt;a href="https://github.com/bryanwb/chef-ark"&gt;&lt;b&gt;ark&lt;/b&gt; resource&lt;/a&gt;. Think of ar&lt;b&gt;k&lt;/b&gt; as an archive but &lt;b&gt;K&lt;/b&gt;ewler. You can thank Joshua Timberman for the name as he didn't care for my original name for it, `cpr` for Crappy Package Resource. CPR was a play on the medical term CardioPulmonary Resuscitation. &amp;nbsp;Ark does not yet handle all of the functionality that install_from_release does&lt;b&gt;. &lt;/b&gt;Install_from_release not not only unpacks tarballs but can build with make, ant, and more. Ark does not currently support ant, make, or setup.py but it wouldn't be too much effort to add that support.&lt;br /&gt;
&lt;br /&gt;
Let's get back to the problem that ark solves. For many of us, the packages available from your given *nix distribution are too old for our needs. This is especially true in the Java ecosystem. The latest stable version of Tomcat is 7.0.26 yet only 7.0.21 is available on ubuntu 11.10. Tomcat 7 isn't even in the main RHEL 6 channels. My customers insist on having the latest security fixes, so installation from rpm/deb isn't an option. Installing the Oracle JDK is an even thornier issue as it is no longer available in Ubuntu nor RHEL software channels.&lt;br /&gt;
&lt;br /&gt;
Here is an example of how I would install the Oracle JDK in the bad old days.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/2145520.js?file=gistfile1.rb"&gt;
&lt;/script&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is how I accomplish the same with ark.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/2145527.js?file=gistfile1.rb"&gt;
&lt;/script&gt;
&lt;br /&gt;
&lt;br /&gt;
Wow! That's a lot easier, and frankly more intuitive. Pretty soon I found myself repeating several variations on the ark resource. At first I accomplished this by adding more attributes to the ark resource. This made the resource more verbose, intuitive, and made the code harder to maintain. A few weeks ago I read Nikolay Sturm's blog post on &lt;a href="http://blog.nistu.de/2012/03/04/reusability-in-configuration-management-systems/"&gt;Cookbook Reusability&lt;/a&gt; and then interviewed him for &lt;a href="http://www.foodfightshow.org/2012/03/episode-6-cookbook-reusability-with.html"&gt;the Food Fight Show&lt;/a&gt;. &amp;nbsp;Through Nikolay, I discovered the &lt;a href="http://www.objectmentor.com/resources/articles/isp.pdf"&gt;Interface Segregation Principle&lt;/a&gt;. &amp;nbsp;Rather than adding more options to the ark resource, I totally refactored ark from an LWRP into a Provider and Resource classes that subclass Chef::Provider::ArkBase and Chef::Resource::ArkBase.&lt;br /&gt;
&lt;br /&gt;
Here is the ark_put resource which handles the simplest case:&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/2145553.js?file=gistfile1.rb"&gt;
&lt;/script&gt;
&lt;br /&gt;
ark_put simply unpacks ivy to the default location /usr/local/ivy, it does not create any symbolic links
&lt;br /&gt;
I often have to download arbitrary collections of dependencies and place them in a lib/ directory. I do this frequently for tomcat-based applications. I just need to "dump" the dependencies in a specified directory that likely already holds a number of library files. This situation is a little more complicated as I need a way to determine whether or not the archive has previously been unpacked. With the ark and ark_put resources I simply check if the destination directory is empty. This logic won't work for a directory like tomcat/lib that holds library files from the initial tomcat installation. For this reason, I have to specify a "creates" attribute which specifies the file whose presence indicates that the ark has already been unpacked. Additionally, I need to discard any file hierarchy inside the archive.
&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/2145566.js?file=gistfile1.rb"&gt;
&lt;/script&gt;
&lt;br /&gt;
ark_dump will place all the *.jar files in the archive into /usr/local/tomcat/lib/. Note: ark_dump currently only supports *.zip archives.
&lt;br /&gt;
&lt;br /&gt;
My friends at Oracle seem bent on making me work for my salary. I have encountered on several occasions the need to extract a single file from a tarball and place it in a arbitrary location. In this case that single file will be specified by the "creates" attribute. In this case I extract the JDBC connector for MySQL. 
&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/2145592.js?file=gistfile1.rb"&gt;
&lt;/script&gt;
&lt;br /&gt;
&lt;br /&gt;
That's the state of the ark resource at the moment. If you are interested to use it and/or extend it, check it out on &lt;a href="https://github.com/bryanwb/chef-ark"&gt;github&lt;/a&gt;. You should note that it is not a collection of&amp;nbsp;&lt;a href="http://wiki.opscode.com/display/chef/Lightweight+Resources+and+Providers+(LWRP)"&gt;LWRP&lt;/a&gt;s&amp;nbsp;but actual Provider and Resource classes. &amp;nbsp;LWRPs are great to get started with but don't provide the same facility for code reuse that pure Ruby does. Thanks to Nikolay Sturm for inspiring me to venture beyond the LWRP DSL and to MrFlip (Philip Kromer) for creating the awesome install_from cookbook. I hope that ark will eventually support all of the functionality that install_from_release does.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Devopsanywhere/~4/CaxmuodwC_8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://devopsanywhere.blogspot.com/feeds/2306787837364988551/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://devopsanywhere.blogspot.com/2012/03/managing-archives-with-ark-resource.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/2306787837364988551?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/2306787837364988551?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Devopsanywhere/~3/CaxmuodwC_8/managing-archives-with-ark-resource.html" title="Unpacking and Installing from Archives with the Ark Resource" /><author><name>Bryan Berry</name><uri>https://plus.google.com/106664679333642993534</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-TyULMG7ZA6A/AAAAAAAAAAI/AAAAAAAAAAA/wjGutwhuhAU/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://devopsanywhere.blogspot.com/2012/03/managing-archives-with-ark-resource.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEEBRng-cCp7ImA9WhRbFk0.&quot;"><id>tag:blogger.com,1999:blog-1083699665345453745.post-3303981299926653566</id><published>2012-02-06T22:50:00.000-08:00</published><updated>2012-02-07T00:17:37.658-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-07T00:17:37.658-08:00</app:edited><title>FOSDEM Summary</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
I thoroughly enjoyed &lt;a href="http://fosdem.org/"&gt;FOSDEM&lt;/a&gt;. The weather sucked, the beer was great,&amp;nbsp;and the people were wonderful. Thanks to the FOSDEM organizers for&amp;nbsp;putting on such a great conference. What follows is a very rough summary of my experience.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://blog.bn2vs.com/wp-content/uploads/2010/02/Fosdem_2010_logo.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://blog.bn2vs.com/wp-content/uploads/2010/02/Fosdem_2010_logo.jpg" width="228" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
I spent most of my time in the Virtualization room. There were a&amp;nbsp;number of interesting talks there.&amp;nbsp;I didn't spend much time in the Configuration Management Devroom, that&amp;nbsp;is not because the content there was lacking but because I felt more&amp;nbsp;knowledegeable about the subjects there than in the Network/IO,&lt;br /&gt;
virtualization, and hypervisor talks where I was pretty much ignorant. From what I could tell, the&lt;br /&gt;
organizers did a fine job organizing the Systems and Configuration&amp;nbsp;Management Devroom.&lt;br /&gt;
&lt;br /&gt;
One of the best parts of going to a conference like this is meeting&amp;nbsp;in person that you have collaborated with via e-mail and IRC. I met up&amp;nbsp;w/ Cheffolk Andrea Campi, Juan Jesus Croissier (juanje), Nicholas&lt;br /&gt;
Szalay (nico), Stefan Jourdan, and Greg Karekinian (sp?). I have interacted with these guys quite&amp;nbsp;extensively over the last four months, so it was awesome to finally&amp;nbsp;meet them. Juanje has a very different use case for Chef than most&amp;nbsp;users. He manages thousands of desktop machines running GNOME. He must&amp;nbsp;take care not to overwrite the users custom settings, a challenge I&amp;nbsp;have never had to deal with. For this reason he created an LWRP to&amp;nbsp;manage portions of a file. Nico has written a nagios check that will&amp;nbsp;report failing chef runs. I need to start using that.&lt;br /&gt;
&lt;br /&gt;
The best moment of FOSDEM for me was a very personal one. I ran into&amp;nbsp;Sulochan Acharya, a friend of mine from Nepal. We worked together to&amp;nbsp;build the &lt;a href="http://www.olenepal.org/"&gt;One Laptop Per Child project in Nepal&lt;/a&gt;. I didn't even know he was in Europe nor still working&amp;nbsp;in IT. Now he works at Rackspace on Openstack-related stuff. It is a&amp;nbsp;small, small open-source world.&lt;br /&gt;
&lt;br /&gt;
Best talks I attended were Anil Madhavapeddy's "&lt;a href="http://fosdem.org/2012/schedule/event/unixio"&gt;Wild West of UNIX I/O&lt;/a&gt;"&amp;nbsp;and Charles Nutter's JRuby talk. Anil talked about the unpredictable&amp;nbsp;behavior that we see in UNIX I/O in virtualized environments. In a&lt;br /&gt;
multicore world, hypervisors don't know enough about the underlying&amp;nbsp;architecture to make intelligent decisions about I/O between CPU&amp;nbsp;cores. This leads to very unpredictable I/O results. According to&amp;nbsp;Anil, this requires a better I/O abstraction that is aware of the&amp;nbsp;underlying microarchitecture--CPU layout, interconnects, NUMA--and can&amp;nbsp;make intelligent choices for the developer. Anil calls his&amp;nbsp;next-generation I/O framework &lt;a href="http://anil.recoil.org/papers/drafts/2012-resolve-draft1.pdf"&gt;FABLE&lt;/a&gt;, which is still in very early&amp;nbsp;development. Charles Nutter is a great speaker though his&lt;br /&gt;
talk was a bit over my head. He focused on the "impossible" challenges&amp;nbsp;of implementing Ruby on the JVM and how his team overcame them.&lt;br /&gt;
&lt;br /&gt;
I missed the ZIO and CERN talks. Both talked about next-generation I/O&amp;nbsp;frameworks. Also sadly missed Jonathan Ellis's talk on "Overcoming JVM&amp;nbsp;limitations in Cassandra". I spent no time w/ the Mozilla track, &amp;nbsp;which&amp;nbsp;is a shame as I love how they manage their community and the kinds of&amp;nbsp;projects they work on.&lt;br /&gt;
&lt;br /&gt;
I was struck by the large number of projects that featured web frontends&amp;nbsp;written in Ruby on Rails. Besides Horizon, the Openstack web UI, it seemed that&amp;nbsp;virtually every other web UI I saw was Rails. Ironically, there were&amp;nbsp;no talks specifically about Ruby nor Rails at FOSDEM.&lt;br /&gt;
&lt;br /&gt;
Red Hat is doing a lot of activity in the DevOps space. oVirt a web UI&amp;nbsp;for managing VMs. Matahari a system administration API which looks&amp;nbsp;interesting but seems like it is still in early development.&amp;nbsp;I had the pleasure of talking w/ Ohad Levy, a very sharp fellow who develops &lt;a href="http://theforeman.org/"&gt;Foreman&lt;/a&gt;, a&amp;nbsp;front-end to Puppet and is employed by Red Hat.&lt;br /&gt;
&lt;br /&gt;
I found out about the meta-project &lt;a href="http://www.katello.org/"&gt;Katello&lt;/a&gt;&amp;nbsp;from Red Hat that contains many&amp;nbsp;components to automate system administration. To my limited knowledge,&amp;nbsp;it includes &lt;a href="http://matahariproject.org/"&gt;Matahari&lt;/a&gt;&amp;nbsp;for low-level administration, Puppet for&amp;nbsp;configuration management, Foreman as a nice GUI to manage your&amp;nbsp;configurations and server provisioning, &lt;a href="http://www.ovirt.org/"&gt;oVirt&lt;/a&gt; to manage your KVM hosts a la VMware's vSphere,&amp;nbsp;and pacemaker-cloud for high-availability across different cloud&amp;nbsp;providers. I believe the combined stack is at alpha level. I would&lt;br /&gt;
love to know if Chef could be used in place of Puppet.&lt;br /&gt;
&lt;br /&gt;
Met the very smart Marek Goldmann who is doing a lot of work packaging JBOSS for&amp;nbsp;Fedora in addition to his &lt;a href="http://boxgrinder.org/"&gt;boxgrinder&lt;/a&gt; project. It seems like there is a fair amount amount of overlap between&amp;nbsp;what he and are trying to do in this regard. I need to spend some time hanging out&amp;nbsp;on #fedora-java to see how we can avoid duplicating efforts.&lt;br /&gt;
&lt;br /&gt;
My greatest regret is that I myself didn't give a presentation. I didn't&amp;nbsp;think I had anything to say that others would be interested, but that&amp;nbsp;view was wholly wrong. There was a lot of interest in Chef but&amp;nbsp;unfortunately not much content.&lt;br /&gt;
&lt;br /&gt;
I met a couple of people who had listened to my podcast, &lt;a href="http://www.foodfightshow.org/"&gt;Food Fight&lt;/a&gt;,&amp;nbsp;but they told me it was "unlistenable" due to the recording quality. Guess I will have to improve the&amp;nbsp;audio quality :(&lt;br /&gt;
&lt;br /&gt;
I was very lucky to have dinner with a group that included the DevOps&amp;nbsp;gurus Kris Buytaert and &amp;nbsp;Patrick DeBois. After following both of them&amp;nbsp;on Twitter for a number of months it was really interesting to see&amp;nbsp;what they are orking on. These guys really are the "Belgian Braintrust" of&amp;nbsp;DevOps not to mention that Patrick actually invented the term. If I&amp;nbsp;recall correctly, both Patrick and Kris are spending a lot of time&lt;br /&gt;
lately working on monitoring and logging. Not only are Kris and Patrick DevOps heroes but they are also genuinely nice guys.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Beer&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Belgians make the best beer in the world and they enjoy it at all&amp;nbsp;hours and in all places. Quite a number of people enjoys fine brews&amp;nbsp;during presentations and meetups. The Opensuse stand actually gave&amp;nbsp;away opensuse beer. Note to self, avoid the 10 % alchohol beer when&amp;nbsp;trying to stay alert. Stick to the delicious 4% blonde beers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Final Thoughts&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Openstack is the real deal, not just a cool idea. It will really be&amp;nbsp;ready for production use this year. I had my doubts about an&amp;nbsp;open-source project led by an industry consortium but what I saw made me put them&lt;br /&gt;
aside. Particularly impressive was Ryan Lane's explanation of how&amp;nbsp;Wikipedia is using Openstack for its infrastructure.&lt;br /&gt;
&lt;br /&gt;
There is awesome stuff happening with KVM, both in terms of&amp;nbsp;performance and tooling.&lt;br /&gt;
&lt;br /&gt;
There was a lot of interest in Chef but I didn't meet that many people&amp;nbsp;who had actually used it. This must be remedied. I really should have given a&amp;nbsp;talk and put more effort into planning a Chef meetup.&lt;br /&gt;
&lt;br /&gt;
I will definitely be back next year and hopefully as a presenter.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Devopsanywhere/~4/H_O_E2lsKjo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://devopsanywhere.blogspot.com/feeds/3303981299926653566/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://devopsanywhere.blogspot.com/2012/02/fosdem-summary.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/3303981299926653566?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/3303981299926653566?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Devopsanywhere/~3/H_O_E2lsKjo/fosdem-summary.html" title="FOSDEM Summary" /><author><name>Bryan Berry</name><uri>https://plus.google.com/106664679333642993534</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-TyULMG7ZA6A/AAAAAAAAAAI/AAAAAAAAAAA/wjGutwhuhAU/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://devopsanywhere.blogspot.com/2012/02/fosdem-summary.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkYFQ3wzeCp7ImA9WhRVF0U.&quot;"><id>tag:blogger.com,1999:blog-1083699665345453745.post-8978922748173487787</id><published>2012-01-15T22:23:00.000-08:00</published><updated>2012-01-16T22:01:52.280-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-16T22:01:52.280-08:00</app:edited><title>Announcing the Food Fight Podcast</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
I just published the inaugural episode of &lt;a href="http://traffic.libsyn.com/foodfight/ff_ep01_2.mp3"&gt;Food Fight&lt;/a&gt;, the Chef community podcast that I host together with &lt;a href="https://plus.google.com/116714115351408264605/posts"&gt;Matt Ray&lt;/a&gt;. The podcast will cover not only the developments within the Chef community but also larger world of DevOps. Enjoy!&lt;/div&gt;
&lt;a href="http://www.foodfightshow.org/"&gt;
&lt;img alt="Food Fight" height="98px; " id="Header1_headerimg" src="http://2.bp.blogspot.com/-DdZ5_ATcmWA/Twg-FMr73tI/AAAAAAAAD3I/7Y7Zi7pZaoY/s1600/FoodFightbanner100px.png" style="display: block;" width="400px; " /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;a href="http://feeds.feedburner.com/TheFoodFightShow"&gt;
&lt;img alt="subscribe to feed" src="http://static.tumblr.com/njo56hx/TOektl8f1/feed_rss.png" /&gt;
&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/Devopsanywhere/~4/mVAtHoHJ8tI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://devopsanywhere.blogspot.com/feeds/8978922748173487787/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://devopsanywhere.blogspot.com/2012/01/announcing-food-fight-podcast.html#comment-form" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/8978922748173487787?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/8978922748173487787?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Devopsanywhere/~3/mVAtHoHJ8tI/announcing-food-fight-podcast.html" title="Announcing the Food Fight Podcast" /><author><name>Bryan Berry</name><uri>https://plus.google.com/106664679333642993534</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-TyULMG7ZA6A/AAAAAAAAAAI/AAAAAAAAAAA/wjGutwhuhAU/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-DdZ5_ATcmWA/Twg-FMr73tI/AAAAAAAAD3I/7Y7Zi7pZaoY/s72-c/FoodFightbanner100px.png" height="72" width="72" /><thr:total>6</thr:total><feedburner:origLink>http://devopsanywhere.blogspot.com/2012/01/announcing-food-fight-podcast.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0IDRHczeyp7ImA9WhRVEUo.&quot;"><id>tag:blogger.com,1999:blog-1083699665345453745.post-7620106825714769374</id><published>2012-01-04T14:08:00.000-08:00</published><updated>2012-01-09T22:06:15.983-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-09T22:06:15.983-08:00</app:edited><title>Chef in 2012</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-9xQ9sitBwhI/TwS-a8aqCgI/AAAAAAAAD1s/gcASShTYAJg/s1600/chef-2.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/-9xQ9sitBwhI/TwS-a8aqCgI/AAAAAAAAD1s/gcASShTYAJg/s320/chef-2.png" width="258" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;image by &lt;a href="http://www.hypertexthero.com/"&gt;Simon Griffee&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;i&gt;Note: &lt;a href="http://petey5king.github.com/who.html"&gt;Petey King&lt;/a&gt; has written a great &lt;a href="http://petey5king.github.com/2012/01/07/response-to-chef-in-2012.html"&gt;response&lt;/a&gt; to this post. Definitely worth a look.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
I discovered Chef in the last last quarter of 2011 and turned my world upside down, work-wise at least, in a really awesome way. Over the holiday season I had some time to reflect about where Chef as a piece of software and as a community of people might go in 2012.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Packaging Cookbooks&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
Cookbooks are starting to more and more look like packages, with complex dependencies between them. I am not aware of any cookbooks that only work with Ruby 1.9.* but I expect we will see a number of them in 2012. I personally believe that we need to use an existing package management system rather than creating yet another one. RPM, DEB, dmg are all out of the question because they are operating system specific. Ruby Gems seems to be the best choice though I am not very knowledgeable about ruby gems. If you think this a terrible idea, please do let me know what problems ruby gems pose. I envision the scenario where your cookbook_path in knife.rb&lt;br /&gt;
&lt;script src="https://gist.github.com/1555727.js"&gt;
 
&lt;/script&gt;
&lt;br /&gt;
&lt;br /&gt;
As you can see from my example, you still would be use cookbooks as they currently are, but also allow chef to look for additional cookbooks in your GEM_PATH. Cookbook gems would have to be prefixed with something like "chef-ckbk-" to indicate to knife which gems are cookbooks.&lt;br /&gt;
&lt;br /&gt;
Using ruby gems does present a couple challenges, particularly with &lt;a href="http://beginrescueend.com/"&gt;rvm&lt;/a&gt;, which completely compartmentalizes gems from one ruby version to another. This means that changing your ruby interpreter &amp;nbsp;requires you install anew a large portion of your cookbooks. Using gems may also require a lot of people to change the structure of their cookbooks. Perhaps, moving moving all the directories to under gem_name/lib/ subdirectory.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Testing 1, 2, 3&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
There still isn't a broad consensus on how to automate the testing of chef cookbooks. There was some nice progress during 2011 with &lt;a href="http://acrmp.github.com/foodcritic/"&gt;foodcritic&lt;/a&gt; (lint for cookbooks), &lt;a href="https://github.com/fujin/minitest-cookbook"&gt;chef-minitest&lt;/a&gt; (unit-testing?), and &lt;a href="https://github.com/Atalanta/cucumber-chef"&gt;cucumber-chef&lt;/a&gt; but those tools are all still early days. Testing is a particular pain point as testing a minor change to a cookbook may require testing against 5 different linux distributions. I really hope we see more progress on this front though I can't point to any particular initiatives. I personally hope to spend some quality time with minitest in the next couple weeks.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Other Miscellaneous Technical Needs&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Selinux support is currently very limited. Some people feel that selinux shouldn't be used in the first place, however, many sysadmins don't have the luxury to make this choice themselves but are required by an external corporate or legal body to use selinux. As Andrea Campi has pointed out on the Chef mailing list, there are a number of consulting firms, such as &lt;a href="http://zephirworks.com/"&gt;ZephirWorks&lt;/a&gt;, that have the capacity to implement better selinux support if someone steps forward with funding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-ddJswxCm23c/TwTNeFkyMtI/AAAAAAAAD14/VTYN3IEQLkg/s1600/chef-4.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="274" src="http://2.bp.blogspot.com/-ddJswxCm23c/TwTNeFkyMtI/AAAAAAAAD14/VTYN3IEQLkg/s320/chef-4.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Image by Simon Griffee&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
The java application stack also needs a lot of love. The current set of tomcat, jetty, maven cookbooks only support minimal configurations. I am reorganizing these cookbooks around the &lt;a href="https://github.com/bryanwb/cookbooks/tree/master/java"&gt;java_ark&lt;/a&gt; LWRP. In a nutshell, the java_ark LWRP extracts a tarball, adds any included executables in the path, and runs update-alternatives. Along with the jboss cookbook I have already started, I expect to put a lot of work into the java stack. If this is something you are interested in, suggestions, code criticism, and patches are most welcome.&lt;br /&gt;
&lt;br /&gt;
While chef-client and chef-server generally perform at acceptable levels, there are some pain points. For chef-client, memory usage can sometimes be an issue due to the node object ballooning in size during chef-client runs. If I recall correctly, Opscode is working hard on reducing memory usage so we should see some progress this year. On the server side, we can expect a lot of performance improvements as &lt;a href="http://wiki.opscode.com/display/chef/Opscode+Chef+Short-Term+Roadmap+and+Performance+Improvements"&gt;chef-server moves from &lt;/a&gt;ruby + couchdb to erlang + mysql. This may happen sooner than one might normally expect as Opscode has already converted part of Hosted Chef to Erlang and MySQL, it just hasn't open-sourced that code yet.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Growing Community&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
2012 should be the year that the myths "Chef is for programmers" and "Chef is hard" are demolished. These myths sadly linger and inhibit adoption in my opinion. Perhaps part of the reason that some sysadmins think Chef is hard is that it is pure Ruby. Now Ruby is not a difficult language but it is unfamiliar to most sysadmins. Advocating Chef (and Puppet to a lesser extent) also means advocating ruby amongst sysadmins. How to do that? Here are a couple suggestions.&lt;br /&gt;
&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;Get ruby 1.9 into the default server installs for RHEL, Ubuntu, ArchLinux, etc. This could be quite a challenge as according to this &lt;a href="http://www.lucas-nussbaum.net/blog/?p=708"&gt;blog post&lt;/a&gt;, there is almost nobody in the Ubuntu world doing any Ruby work. With the exception of the awesome Sergio Rubio, the same could be said for RHEL/CentOS/SL&lt;/li&gt;
&lt;li&gt;More blog articles on using Ruby to solve system administration problems and that sysadmins should consider using Ruby as their default scripting language&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
All that talk about Ruby advocacy aside, Sysadmins will need to know less Ruby in 2012 in order to write Chef recipes. This is because we will see more and more LWRPs pop up. I love LWRPs. I think they are the best thing since dynamically loadable kernel modules.&lt;br /&gt;
&lt;br /&gt;
Chef is growing by leaps and bounds because it solves an important problem in configuration management. The greatest constraint to that growth is the supply of sysadmins willing to make the investment to learn it. At this point, the majority of the community are self-taught linux geeks who found Chef on their own. At the next stage of growth, Chef needs to be attractive to the group I call "&lt;i&gt;the Professionals&lt;/i&gt;". &lt;i&gt;Professionals&lt;/i&gt; are talented engineers&amp;nbsp;who make system administration their job but not their life. They don't read blogs during their lunch hour and they don't hang out on IRC in the evenings. The &lt;i&gt;Professionals&lt;/i&gt; will typically learn Chef because their bosses tell them to. We need to make that learning process as smooth as possible.&lt;br /&gt;
&lt;br /&gt;
The Chef wiki is an incredible reference but we need a guided tour to accompany it. We really need the Chef equivalent to&amp;nbsp;&lt;a href="http://www.amazon.com/Pro-Git-Chacon/dp/1430218339/ref=sr_1_1?ie=UTF8&amp;amp;qid=1325713836&amp;amp;sr=8-1"&gt;Pro Git&lt;/a&gt; and the &lt;a href="http://book.git-scm.com/"&gt;Git Community Book site&lt;/a&gt;. These resources hold your hand and walk you through all the important parts, whispering comforting words when you get frustrated. I know there is work being done a Definitive Guide to Chef from a major publisher, but I don't know its status.&lt;br /&gt;
&lt;br /&gt;
Lastly on the subject of community, we need some mechanisms to summarize community activity.&lt;br /&gt;
The Chef project has a high velocity and I find it increasingly hard to keep up with. &amp;nbsp;The Opscode monthly newsletter is a good step in this direction. Additionally, I am starting a Chef podcast together with Opscode Technical Evangelist &lt;a href="http://devopsanywhere.blogspot.com/2012/01/chef-in-2012.html"&gt;Matt Ray&lt;/a&gt;, focused on summarizing community activity and exploring important topics.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Dangers in 2012&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I sometimes worry that Chef could become a victim of its own success. As I mentioned earlier, the greatest constraint to the growth of Chef is the supply of sysadmins willing and able to learn it. &amp;nbsp;If enough well-meaning software architects and aggressive CIOs force Chef on resistant ops teams, we will start hearing about implementations gone horribly wrong. Top-down adoption can only work if the ground below is fertile. That's my two cents.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;In Summary&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Chef will be a success when the default installation instructions for application X point to a Chef cookbook. I think we will make solid progress towards this goal in 2012 but to really get there, a lot of &amp;nbsp;things have to happen first. I couldn't be more excited. Thanks to everyone in the Chef community for giving sysadmins like me such a great toy to play with. Happy Hacking!&lt;br /&gt;
&lt;br /&gt;
PS: Let me know if you like the Chef icons. My good buddy Simon Griffee created them after a brainstorming session fueled by &lt;a href="http://en.wikipedia.org/wiki/Sagrantino_di_Montefalco"&gt;Sagrantino Di Montefalco&lt;/a&gt;.&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Devopsanywhere/~4/gGKlYxxuDYw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://devopsanywhere.blogspot.com/feeds/7620106825714769374/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://devopsanywhere.blogspot.com/2012/01/chef-in-2012.html#comment-form" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/7620106825714769374?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/7620106825714769374?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Devopsanywhere/~3/gGKlYxxuDYw/chef-in-2012.html" title="Chef in 2012" /><author><name>Bryan Berry</name><uri>https://plus.google.com/106664679333642993534</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-TyULMG7ZA6A/AAAAAAAAAAI/AAAAAAAAAAA/wjGutwhuhAU/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-9xQ9sitBwhI/TwS-a8aqCgI/AAAAAAAAD1s/gcASShTYAJg/s72-c/chef-2.png" height="72" width="72" /><thr:total>6</thr:total><feedburner:origLink>http://devopsanywhere.blogspot.com/2012/01/chef-in-2012.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0EFQHcyfSp7ImA9WhRSGEg.&quot;"><id>tag:blogger.com,1999:blog-1083699665345453745.post-9135539448009990670</id><published>2011-11-20T05:14:00.001-08:00</published><updated>2011-11-20T23:13:31.995-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-20T23:13:31.995-08:00</app:edited><title>Emacs for Sysadmins</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
I am not going to tell you that emacs is superior to vi, because it is not. For me, vi is far better for basic text editing. However, emacs has such powerful modes that I find myself using it more often than vi these days. Emacs has historically been favored by programmers and vi by sysadmins. I have written in the past &amp;nbsp;that sysadmins are becoming less like ninjas and more like pirates because of this crazy thing called devops.&lt;br /&gt;
&lt;br /&gt;
As a professional system administrator you can't choose between vi and emacs; you have to learn vi. There are just too many times you will be working on an arbitrary *nix that only has vi installed. You can choose to learn emacs in addition to vi. Vi lets you jump in and around files quickly. Nothing can match the speed of &lt;i&gt;hjkl&lt;/i&gt;, &lt;i&gt;g&lt;/i&gt;, &lt;i&gt;G&lt;/i&gt;, etc. for movement or &lt;i&gt;v&lt;/i&gt; + &lt;i&gt;y&lt;/i&gt; for copying text. However, we sysadmins are moving from managing individual servers to managing configurations. In the last several couple months I have spent at least 50% of my work time entirely within my chef-repo/ directory working on data bags, roles, and cookbooks. Inspired by the devotion of a number of Chef community members to emacs--notably Matt Ray, Stephen Nelson-Smith, Josh Timberman, among others--I decided to give emacs a try. On the whole, it has been a very positive experience. That is why I recommend sysadmins try emacs.&lt;br /&gt;
&lt;br /&gt;
&lt;table border="0" style="width: 320px;"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;&lt;strong&gt;Ninja&lt;/strong&gt;&lt;/center&gt;&lt;/td&gt;
&lt;td&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;&lt;strong&gt;Pirate&lt;/strong&gt;&lt;/center&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img alt="bill-joy1" class="center size-thumbnail wp-image-1180" height="150" src="http://philosecurity.org/wp-content/uploads/2009/03/bill-joy1-150x150.jpg" title="bill-joy1" width="150" /&gt;&lt;/td&gt;
&lt;td&gt;&lt;img alt="richard-stallman-small" class="center size-thumbnail wp-image-1181" height="150" src="http://philosecurity.org/wp-content/uploads/2009/03/richard-stallman-small-150x150.jpg" title="richard-stallman-small" width="150" /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;&lt;strong&gt;Bill Joy&lt;br /&gt;Vi Creator&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;Hand placement conceals poison dart&lt;/em&gt;&lt;/center&gt;&lt;/td&gt;
&lt;td&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;&lt;strong&gt;Richard Stallman&lt;br /&gt;Emacs Creator&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;Note beard&lt;/em&gt;&lt;/center&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
from philosecurity blog &lt;a href="http://philosecurity.org/2009/03/23/pirates-and-ninjas-emacs-or-vi"&gt;ninjas or pirates, emacs or vi&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;Why Emacs?&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Emacs has some truly awesome modes. The default ruby, python, bash, xml, html seem to do more than their vim counterparts. I think this is large part because emacs' extension language (elisp) is more powerful than vimscript. I made a stab at vimscript some years ago but came away quite frustrated. While I am not a lisp convert, it is a full-featured language that doesn't hold you back. Working with multiple buffers (10+) is extremely easy. Org-mode though, is what got me hooked.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;Why Not Emacs?&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Using vi is like being in a relationship, you are involved. Using Emacs is like a marriage, you are committed, in large part because there is so much to learn. This is one of the reasons I don't recommend it for everyone.&lt;br /&gt;
&lt;br /&gt;
Further, vi is built for touch typists. You rarely, if ever, have to take your fingers off the home row keys. You can keep your fingers on the home row with emacs but that often means completing a number of key chords entirely with your left hand. Take for example opening a file, writing its contents to another file, and then closing emacs.&lt;br /&gt;
&lt;br /&gt;
C-x C-f &amp;nbsp;+ C-x C-w + C-x C-k&lt;br /&gt;
&lt;br /&gt;
If you keep your fingers on the home row, you will only use your left-hand for the above commands, except for the final "k". You could start to feel some discomfort in your left hand if you did that key sequence several times in a row. For this reason a number of emacs addicts will hit the Control key with their right hand, the "x" with their left, Control again with the right, "f" with the left, and so on. This leads to a more "hunt and peck" typing style but saves your hands.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;First, Learn How to be a Pirate&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
Before you even start playing with emacs you should make sure to swap your Caps Lock and left Control key. Emacs commands use the Control key heavily and leaving it in the default position will soon leave you angry, crippled, and ready to kill Richard Stallman.&lt;br /&gt;
&lt;br /&gt;
Next, I recommend you organize your dotfiles on github or another source code repository. Being a pirate means you have booty and treasure to carry around. You need a ship to carry around all that treasure and for me that ship is &lt;a href="https://github.com/bryanwb/dotfiles"&gt;github&lt;/a&gt;. The core of my dotfiles repo is the Rakefile, copied &lt;a href="http://github.com/ryanb/dotfiles/tree/master"&gt;from Ryan Bates' master&lt;/a&gt;, that makes it dead simple to install your dotfiles on a new machine. I don't install my dotfiles on every machine I work on, only the 2-3 I use most frequently.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;&amp;nbsp;create your own github/bitbucket/private github repo called dotfiles&lt;/li&gt;
&lt;li&gt;copy your existing dotfiles -- .bashrc, .vimrc, .emacs, etc -- to ~/dotfiles but without the leading "." !&lt;/li&gt;
&lt;li&gt;download Ryan Bates &lt;a href="http://github.com/ryanb/dotfiles/tree/master"&gt;Rakefile&lt;/a&gt;&amp;nbsp;and put it in ~/dotfiles&lt;/li&gt;
&lt;li&gt;to test, rename ~/.bashrc to to ~/.bashrc_bak then run $ cd ~/dotfiles/ &amp;amp;&amp;amp; rake install. &amp;nbsp;Your .bashrc should be back&lt;/li&gt;
&lt;li&gt;Push to your repository&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
Whenever you make a change to your .emacs or .bashrc &amp;nbsp;on your ubuntu laptop at home, remember to push your changes and then run "rake install" on your work desktop.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;Learning Emacs&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
OK, finally emacs. I recommend you buy Peepcode's "&lt;a href="http://peepcode.com/products/meet-emacs"&gt;Meet Emacs&lt;/a&gt;" tutorial. It is only $12 and it is the best and most convincing emacs tutorial. It is well worth the money. If this tutorial doesn't convince you that emacs is worth your time stop, turn around, and go back to vi. One of the first things covered in "Meet Emacs" is how to install emacs 24 and the &lt;a href="https://github.com/technomancy/emacs-starter-kit"&gt;emacs-starter-kit&lt;/a&gt;. The emacs starter kit will set of bunch of defaults that help you avoid many of emacs' warts and show off some awesomeness such as ido-mode.&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;Org-Mode, Emacs Killer Feature&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Ok, I have to admit that I have been working with emacs for longer than a few months. I have been using emacs' &lt;a href="http://orgmode.org/"&gt;Org-Mode&lt;/a&gt; to manage my life for the last several years, ever since I happened upon Abhijeet Chavan's &lt;a href="http://www.linuxjournal.com/article/9116"&gt;great article&lt;/a&gt; in Linux Journal. Soon after that, I came across Scott Jaderholm's excellent &lt;a href="http://jaderholm.com/screencasts/org-mode/"&gt;screencast&lt;/a&gt; for Org-mode. At the time I read the article, I was the Chief Technology Officer for a &lt;a href="http://olenepal.org/"&gt;non-profit technology startup&lt;/a&gt; in Kathmandu, Nepal. I was completely overwhelmed by the sheer volume of different tasks I had to accomplish and all the attendant details, especially the details. I no longer have all that stress now that I am a regular sysadmin, but I do have a large number of very detailed tasks. Org-mode is in many ways my memory. It is also how I manage my attention span.&lt;br /&gt;
&lt;br /&gt;
Many people use Org-mode to implement the &lt;a href="http://en.wikipedia.org/wiki/Getting_Things_Done"&gt;Getting Things Done&lt;/a&gt; methodology, pioneered by David Allen. I have bastardized it into my own system.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-YG4mlBF85cM/TsljdPUJn_I/AAAAAAAAD04/T-rK8LZA3-A/s1600/Screenshot--home-hitman-org-mygtd.org.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="204" src="http://3.bp.blogspot.com/-YG4mlBF85cM/TsljdPUJn_I/AAAAAAAAD04/T-rK8LZA3-A/s320/Screenshot--home-hitman-org-mygtd.org.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Today is a list of general things that I want to get done today. This week, a list of tasks to complete this week. And of course, right now is a list of specific next actions, that I will complete starting at 1.&lt;br /&gt;
&lt;br /&gt;
When you are finished with a task, don't delete it. Archive it so you have a record of when you are done. Org-mode handily records the timestamp of when you completed the item.&lt;br /&gt;
&lt;br /&gt;
C-c $ &amp;nbsp; &amp;nbsp; &amp;nbsp; # archives a subtree to your archive file,&lt;br /&gt;
&lt;br /&gt;
If I finish reading the O'Reilly Emacs Manual and then archive it, here is what the entry looks like.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-Qm_vnCJc3sc/Tslj_wC_jII/AAAAAAAAD1A/lyX-MfaBoEI/s1600/Screenshot--home-hitman-org-mygtd.org_archive.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="204" src="http://3.bp.blogspot.com/-Qm_vnCJc3sc/Tslj_wC_jII/AAAAAAAAD1A/lyX-MfaBoEI/s320/Screenshot--home-hitman-org-mygtd.org_archive.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
I love that I can move items in a numbered list almost effortlessly. M-&amp;lt;up&amp;gt; moves an item up and adjusts the numbering and M-&amp;lt;down&amp;gt; moves an item down in the list.&lt;br /&gt;
&lt;br /&gt;
I typically keep the following org-mode files and their associated archive files.&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;mygtd.org -- my todo list, for today, this week, this month, and right now!&lt;/li&gt;
&lt;li&gt;meetings.org -- all meeting notes and preparation&lt;/li&gt;
&lt;li&gt;notes.org &amp;nbsp;-- this is where I keep notes while I work on a problem&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
The notes.org file deserves special attention. This is my running work log. As I diagnose a problem, I write up my possible hypotheses, then tests for these hypotheses. Finally, I record the results of testing those hypotheses, pass or fail.&lt;br /&gt;
&lt;br /&gt;
The true beauty of using emacs to manage your todo list is that you can grep through it to find a specific piece of information. This has saved my ass more times than I can count.&lt;br /&gt;
&lt;br /&gt;
Org-mode protip: put your *.org files in a Dropbox folder so you have access to them on your various machines. It may be tempting to put them on github but you should realize that those org files will quickly fill up with personal and corporate information.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;Working with Buffers&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
I never found it that easy to work with multiple buffers or tabs in vim without doing extensive key rebinding. Buffers are something that emacs really gets right, especially when you have ido-mode turned on. I have found working with multiple &amp;nbsp;buffers really effective when working with several chef cookbooks at once.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-T9ElGJY_-wc/Tslo0NHBxuI/AAAAAAAAD1Q/x8dSy_ruq_U/s1600/Screenshot-+*Minibuf-1*-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="204" src="http://2.bp.blogspot.com/-T9ElGJY_-wc/Tslo0NHBxuI/AAAAAAAAD1Q/x8dSy_ruq_U/s320/Screenshot-+*Minibuf-1*-1.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;br /&gt;
Let's say I am working in the sudo/recipes/default.rb recipe but want to jump back to the previous recipe I was working on, in this case iptables/recipes/default.rb. I type C-x b and ido-mode shows me a list of open buffers. To get the last buffer I was in before this, simply hit [RET] or I can start typing the name of the file and ido-mode will dynamically filter that list.&lt;br /&gt;
&lt;br /&gt;
C-x b &amp;nbsp;[RET] &amp;nbsp;to get to the last visited buffer&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;Dired-Mode&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
I have always heard that &lt;a href="https://www.midnight-commander.org/"&gt;Midnight Commander&lt;/a&gt; is an awesome but I have never taken the time to learn it. I believe that Dired-Mode offers many of the features of Midnight Commander but lets you leverage the emacs skills you have picked up.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-Yam6fKpPfvE/TslsXWRG2VI/AAAAAAAAD1Y/tbzqslKbQ3w/s1600/Screenshot-cookbooks.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="206" src="http://2.bp.blogspot.com/-Yam6fKpPfvE/TslsXWRG2VI/AAAAAAAAD1Y/tbzqslKbQ3w/s320/Screenshot-cookbooks.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Here are commands that I love&lt;br /&gt;
&lt;br /&gt;
&lt;table border="2" bordercolor="#0033FF" cellpadding="3" cellspacing="3"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th&gt;Key Binding&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;v&lt;/td&gt;
&lt;td&gt;View a file or directory in read-only mode&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;d&lt;/td&gt;
&lt;td&gt;mark a file or directory for deletion&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;C&lt;/td&gt;
&lt;td&gt;Copy a file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;x&lt;/td&gt;
&lt;td&gt;execute changes marked, i.e. delete files marked for deletion&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;q&lt;/td&gt;
&lt;td&gt;close an open dired buffer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;[RET]&lt;/td&gt;
&lt;td&gt;when u hit [RET] on a file, emacs opens it for editing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;R&lt;/td&gt;
&lt;td&gt;Rename or move a file or directory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;M-x find-grep-dired&lt;/td&gt;
&lt;td&gt;Grep a directory for a regex and then view the matching files in a Dired Buffer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Q&lt;/td&gt;
&lt;td&gt;Find and replace a regex across multiple files&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
While Dired-Mode is very useful for managing files I find it most useful for browsing code. You can hit "v" to view as read-only then q to close that buffer when you are done. Viewing files in emacs means you get all that juicy syntax highlighting. This helps me make sense of those butt-ugly XML configuration files I encounter on jboss and tomcat installations.&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Miscellaneous Stuff I find Useful in Emacs&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Shell-Mode - This is very handy for moving text back and forth from a shell and code file. &amp;nbsp;&lt;i&gt;M-x shell-command-region&lt;/i&gt;&amp;nbsp;or &lt;i&gt;M-!&lt;/i&gt; lets you execute a shell command on a region of selected text&lt;/li&gt;
&lt;li&gt;Inf-Ruby-mode - lets you select a bunch of ruby code and immediately execute it in an irb session. I would love to see this work with &lt;a href="http://wiki.opscode.com/display/chef/Shef"&gt;shef&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Modes for Languages you rarely touch - I rarely code in java but occasionally I have to read java code. java-mode helps me parse java without having to deal with Eclipse. Have to change a config file written in Erlang? There's a mode for that.&lt;/li&gt;
&lt;li&gt;Properly indenting text - select a region then &lt;i&gt;C-M-\&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;Completion - &lt;i&gt;M-/&lt;/i&gt; will guess what you are trying to type based on open buffers&lt;/li&gt;
&lt;li&gt;Commenting out multiple lines of code -- select a region, &lt;i&gt;M-;&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Emacs Shortcuts are Everywhere&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
In case you haven't already noticed, virtually every unix shell and programming REPL (irb, python, perl) supports Emacs keyboard shortcuts. This is because all those shells are built on top of libreadline, which implements a subset of emacs shortcuts. Even REPL's for newer JVM languages like scala, groovy, and clojure use a clone of libreadline, jline, that implements those same shortcuts.&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Emacs Stuff I Haven't Learned Yet but Want to&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;Tramp-Mode -- editing files over SSH, this would be pretty sweet for configuring a bunch of Virtual Box VM's running on my desktop&lt;/li&gt;
&lt;li&gt;Calendar Integration with gmail - just haven't gotten around to this yet&lt;/li&gt;
&lt;li&gt;ERC - I debate whether to move from Xchat to irrsi or ERC (Emacs irc client). jury is still out&lt;/li&gt;
&lt;li&gt;gist - This is a mode that allows you to select a region and create a github gist from it&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Wrapping Up&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Emacs, despite conventional wisdom, can be very useful for systems administrators and not solely the domain of Lisp Hackers and not Exclusively for Middle-Aged Computer Scientists. While it may be One True Program for some people, it is not for everyone. The highlights of Emacs for me are:&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;Org-mode -- time management for busy sysadmins&lt;/li&gt;
&lt;li&gt;Dired Mode&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Buffer Management&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
If you have some tricks that you find especially useful for sysadmin work, please share them!&amp;nbsp;Here are some additional resources you may want to look at:&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;&lt;a href="http://batsov.com/articles/2011/11/19/why-emacs/"&gt;Why Emacs?&lt;/a&gt;&amp;nbsp;Borizhdar Batisov's excellent, more developer-focussed ode to emacs&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.youtube.com/user/rpdillon?blend=16&amp;amp;ob=5"&gt;Hack Emacs&lt;/a&gt; Screencasts&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.masteringemacs.org/"&gt;Mastering Emacs blog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.google.it/url?sa=t&amp;amp;rct=j&amp;amp;q=emacswiki&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0CCEQFjAA&amp;amp;url=http%3A%2F%2Fwww.emacswiki.org%2F&amp;amp;ei=cvDJTp-oA8_Lsga69cj5Dg&amp;amp;usg=AFQjCNGUR32VnH8IftoPDbPepFoTRlpUAg"&gt;Emacswiki&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;#emacs on freenode.net&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Devopsanywhere/~4/Acq_DoqSY_o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://devopsanywhere.blogspot.com/feeds/9135539448009990670/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://devopsanywhere.blogspot.com/2011/11/emacs-for-sysadmins.html#comment-form" title="9 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/9135539448009990670?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/9135539448009990670?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Devopsanywhere/~3/Acq_DoqSY_o/emacs-for-sysadmins.html" title="Emacs for Sysadmins" /><author><name>Bryan Berry</name><uri>https://plus.google.com/106664679333642993534</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-TyULMG7ZA6A/AAAAAAAAAAI/AAAAAAAAAAA/wjGutwhuhAU/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-YG4mlBF85cM/TsljdPUJn_I/AAAAAAAAD04/T-rK8LZA3-A/s72-c/Screenshot--home-hitman-org-mygtd.org.png" height="72" width="72" /><thr:total>9</thr:total><feedburner:origLink>http://devopsanywhere.blogspot.com/2011/11/emacs-for-sysadmins.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU8ASXY8cCp7ImA9WhRSF0Q.&quot;"><id>tag:blogger.com,1999:blog-1083699665345453745.post-3772433204669444190</id><published>2011-11-20T00:26:00.001-08:00</published><updated>2011-11-20T06:04:08.878-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-20T06:04:08.878-08:00</app:edited><title>Chef for Developers</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
Last Friday I gave a presentation to a group of developers on how they can get started writing Chef cookbooks. I put about 5 hours into writing this presentation. To my chagrin, Warwick Poole released a &lt;a href="http://learnchef.getharvest.com/"&gt;superior presentation&lt;/a&gt;&amp;nbsp;that same afternoon that does a better job of explaining the basic concepts of Chef. I strongly recommend checking out Warwick's &lt;a href="http://learnchef.getharvest.com/"&gt;"LearnChef"&lt;/a&gt; if you haven't already. It is the single best introduction to Chef that I have seen so far. In more good news, Warwick informs me that he intends to create a 5 part series building on "LearnChef." I very much look forward to it.&lt;br /&gt;
&lt;br /&gt;
My Chef presentation doesn't do as good a job explaining the core concepts of Chef but it does walk developers through some scenarios on how they can work with chef on a project. You can check it out below and even reuse my slide material by downloading the .ppt file&amp;nbsp;&lt;a href="https://docs.google.com/presentation/d/1ZLMwDeUCu84o6qWGlGfi3x-buhC2YorAYxD7v6hA92o/edit"&gt;here&lt;/a&gt;. My slides borrow heavily from Joshua Timberman's excellent &lt;a href="http://wiki.opscode.com/download/attachments/2883634/Chef-101-OSCON_Preview.pdf?version=1&amp;amp;modificationDate=1278531594000"&gt;Chef 101 presentation&lt;/a&gt;. The slides are under the Creative Commons 3.0 Unported CC-BY-SA. You can find the &lt;a href="http://wiki.opscode.com/display/chef/Chef+Presentations"&gt;full list&lt;/a&gt; of publicly available Chef presentations on the Chef wiki.

&lt;br /&gt;
&lt;div id="__ss_10238978" style="width: 425px;"&gt;
&lt;strong style="display: block; margin: 12px 0 4px;"&gt;&lt;a href="http://www.slideshare.net/bryanwb/chef-devops-and-you" title="Chef, Devops, and You"&gt;Chef, Devops, and You&lt;/a&gt;&lt;/strong&gt;&lt;object height="355" id="__sse10238978" width="425"&gt;&lt;param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=chef-101-bwb-v3-111120022114-phpapp01&amp;stripped_title=chef-devops-and-you&amp;userName=bryanwb" /&gt;


&lt;param name="allowFullScreen" value="true"/&gt;


&lt;param name="allowScriptAccess" value="always"/&gt;


&lt;param name="wmode" value="transparent"/&gt;


&lt;embed name="__sse10238978" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=chef-101-bwb-v3-111120022114-phpapp01&amp;stripped_title=chef-devops-and-you&amp;userName=bryanwb" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="transparent" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;
&lt;div style="padding: 5px 0 12px;"&gt;
View more &lt;a href="http://www.slideshare.net/"&gt;presentations&lt;/a&gt; from &lt;a href="http://www.slideshare.net/bryanwb"&gt;Bryan Berry&lt;/a&gt;.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Devopsanywhere/~4/EFETL--uqAE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://devopsanywhere.blogspot.com/feeds/3772433204669444190/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://devopsanywhere.blogspot.com/2011/11/chef-presentations.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/3772433204669444190?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/3772433204669444190?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Devopsanywhere/~3/EFETL--uqAE/chef-presentations.html" title="Chef for Developers" /><author><name>Bryan Berry</name><uri>https://plus.google.com/106664679333642993534</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-TyULMG7ZA6A/AAAAAAAAAAI/AAAAAAAAAAA/wjGutwhuhAU/s512-c/photo.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://devopsanywhere.blogspot.com/2011/11/chef-presentations.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUQEQHw8fSp7ImA9WhdaGUQ.&quot;"><id>tag:blogger.com,1999:blog-1083699665345453745.post-2661785546577878625</id><published>2011-10-30T06:14:00.000-07:00</published><updated>2011-10-30T09:48:21.275-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-30T09:48:21.275-07:00</app:edited><title>A Month with Chef</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
It is hard to believe that I started using &lt;a href="http://wiki.opscode.com/display/chef/Home"&gt;Chef&lt;/a&gt; only one month ago. The experience has hugely changed how I view the practice of system administration and started to unseat the deepest of ingrained habits. It has been mostly a smooth ride but there have been some significant bumps along the way. Here are my reflections on learning Chef, the community around it, putting it to work, and my hopes for the future of the project.&lt;br /&gt;
&lt;div class="p1"&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;Learning Curve&lt;/b&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
There are roughly three technology components to learning chef, each with their own learning curve 1) the Chef software itself 2) git and 3) ruby. I found understanding Chef to be quite easy, in large part because of prior experience with Puppet. If you have never used a configuration management tool before, this can be a stumbling block. However, the biggest stumbling block of the three is probably git, not ruby and not the Chef software itself. Again, I had previous experience with git but even I ran into occasional git-induced hurdles.&amp;nbsp;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
When you treat your "infrastructure as code," you have to spend a fair amount of time managing that code. Git is the tool you will use to manage your chef repository, your cookbooks, pull updates the mainline opscode/cookbooks and push your patches to others. If you are a n00b to both &amp;nbsp;Chef and git, do yourself a favor and reach for &lt;a href="http://ftp.newartisans.com/pub/git.from.bottom.up.pdf"&gt;&lt;span class="s1"&gt;a good git tutorial&lt;/span&gt;&lt;/a&gt; before you get too deep into Chef.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
The fact that Chef recipes are written in Ruby has turned out to be far less of an impediment than I thought. You can learn enough Ruby to write a recipe &lt;a href="http://wiki.opscode.com/display/chef/Just+Enough+Ruby+for+Chef"&gt;&lt;span class="s1"&gt;in less than twenty minutes&lt;/span&gt;&lt;/a&gt;. Further, with copy-and-paste plus playing with &lt;a href="http://en.wikipedia.org/wiki/Interactive_Ruby_Shell"&gt;irb&lt;/a&gt; you can guess your way to getting a lot accomplished--though this isn't a good strategy for the long-term. For my own education, I read the &lt;a href="http://pragprog.com/book/ruby/programming-ruby"&gt;&lt;span class="s2"&gt;pickaxe book&lt;/span&gt;&lt;/a&gt; and Flanagan's &lt;a href="http://shop.oreilly.com/product/9780596516178.do"&gt;&lt;span class="s2"&gt;The Ruby Programming Language&lt;/span&gt;&lt;/a&gt;. Both were good but I prefer the Ruby Programming Language. I have heard from others that &lt;a href="http://rubykoans.com/"&gt;Ruby Koans&lt;/a&gt; is an excellent way to learn Ruby though I haven't tried them myself.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
My first impressions of Ruby the language are shaped in part by my experiences working in the Python world. Python is clean and neat and you can see the hand of &lt;a href="http://www.python.org/~guido/"&gt;&lt;span class="s2"&gt;Guido&lt;/span&gt;&lt;/a&gt;&amp;nbsp;guiding the language and standard library at every turn. Conversely, Ruby is creative, chaotic, and messy. It has bitten me in the ass several times that Ruby has hundreds of top-level methods and operators. To say that the namespaces are "cluttered" is an understatement. You have to be quite careful when creating new variables and method names. For instance, In one recipe I created the variables "alias" and "rand", which are coincidentally top-level Ruby methods. Overwriting them caused some nasty side effects that took me a while to track down. If Ruby were a human being it would have a beautiful body, a terrible case of acne, and noticeable digestive problems. Worse yet, its clothes wouldn't match.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
My biggest single problem with Ruby is that &lt;i&gt;shit breaks&lt;/i&gt;. Last week the main json gem was broken, causing pain throughout the Ruby world. With my first install of Chef-Server, the code-ray gem broke the chef-server-webui. As I am not a rubyist, it took me a non-trivial amount of time to figure out how to downgrade to an older version with the following command &lt;i&gt;$ gem install code-ray --version '&amp;lt; 0.9.8'.&lt;/i&gt; I have since discovered the concept of gem sets, which define dependencies to specific gems per specific versions. Why would you have to do this? Because you can't count that the latest gem release will be stable. Working with Python I rarely had these same kinds of problems. On the plus side, the Ruby community &lt;i&gt;moves fast&lt;/i&gt;. For whatever reason(s), new Ruby projects pop up quickly and continue to evolve at an astonishing pace. Tools like &lt;a href="https://github.com/wycats/thor/wiki"&gt;&lt;span class="s2"&gt;thor&lt;/span&gt;&lt;/a&gt;, &lt;a href="http://www.sinatrarb.com/"&gt;&lt;span class="s2"&gt;sinatra&lt;/span&gt;&lt;/a&gt;, &lt;a href="https://github.com/capistrano/capistrano/wiki/"&gt;&lt;span class="s2"&gt;capistrano&lt;/span&gt;&lt;/a&gt;, and &lt;a href="http://fog.io/1.0.0/index.html"&gt;&lt;span class="s2"&gt;fog&lt;/span&gt;&lt;span class="s1"&gt; &lt;/span&gt;&lt;/a&gt;all seemed to appear before &amp;nbsp;their Pythonic equivalents*.&lt;/div&gt;
&lt;div class="p3"&gt;
&lt;i&gt;* software historians, please correct me if I am mistaken&lt;/i&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
It is easy to overlook that Chef assumes you already thoroughly understand your operating system and application stack. Chef makes experienced system administrators more productive. It also makes inexperienced system administrators more dangerous and can even hamper their learning. It is for this reason that I don't recommend that those new to *nix pick up Chef. You can't automate something you don't understand.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;b&gt;Using Chef&lt;/b&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
My experience with Chef has not been all roses. Like Ruby, Chef moves fast. For a FOSS project, it is ridiculously young, first released in January 2009 and has not even reached version 1.0 yet. It still has significant bugs and Linux distribution support is still quite uneven, especially compared to &lt;a href="http://www.puppetlabs.com/"&gt;Puppet&lt;/a&gt;. To their credit, the Opscoders acknowledge these issues. It must be noted, Opscode did not officially support Enterprise Linux until recently.&amp;nbsp; Further, despite its youth, I found the Chef-Server to be quite stable and easy to setup.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
I had a nasty time with the initial installation. It took me over three days to complete, mostly due to a bug in Ohai that misreported the linux distribution. However, that was early October. I did a fresh install last week and it took me only 30 minutes, largely due to documentation improvements, bug fixes, and updated rpms for both EL 5 and 6.&amp;nbsp;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
The &lt;a href="https://github.com/opscode/cookbooks"&gt;opscode cookbooks&lt;/a&gt;, like the chef software, have spotty support for Enterprise Linux. One of the first cookbooks I tried to use was the selinux cookbook. I couldn't even upload that cookbook to my chef-server as it has a syntax error. I have sent a patch, logged a ticket, and sent a pull request to fix the error. That issue was not fixed the last time I checked. My pull request isn't lonely either. Last time I checked on github.com and I saw that there were 99 open pull requests &lt;a href="https://github.com/opscode/cookbooks/pulls"&gt;in their queue&lt;/a&gt;. My impression is that the Opscoders are not intentionally ignoring such requests but are struggling to keep up with the rapid growth of Chef community and Opscode's paying customer base. I hope this improves in the months ahead.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
Once I got Chef-server up and running, I felt a bit lost. Chef is a very flexible tool and not nearly as opinionated as Puppet. It is hard to decide where to get started. One can easily get lost among Chef's powerful abstractions such as definitions, providers, resources, and libraries. Worse, Chef doesn't have a definitive technical book to hold your hand through the entire process as James Turnbull's excellent "&lt;a href="http://www.apress.com/9781430230571"&gt;Pro Puppet&lt;/a&gt;" does for Puppet.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
After my initial bout of confusion I set to work on converting a 400-line RHEL 5 server provisioning shell script into a set of cookbooks. Amazingly, I was able to convert it to a set of Chef cookbooks in less than a week and a half. Even better, these cookbooks could be applied to an existing server at any time in its life, not just at installation time. Bonus, my bash script handled RHEL/CentOS 5-6 on x86_64 and i386 architectures whereas the original bash script only handled RHEL 5 x86_64. I must confess that part of my productivity gains stem from the fact that I am far more proficient in RHEL than I was when I originally wrote the Bash script. That said, I believe that using Chef for the server provisioning task took me 30-40% of the time it would have required to rewrite the Bash script to handle RHEL 6 and the i386 architecture.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
I have made a lot of progress with Chef in this first month but I have yet to automate an entire application stack. Here are the tasks I hope to implement with Chef in the next few months:&lt;/div&gt;
&lt;ul class="ul1"&gt;
&lt;li class="li1"&gt;Consistently test my cookbooks with rspec or another testing tool&lt;/li&gt;
&lt;li class="li1"&gt;Create a Jboss cookbook&lt;/li&gt;
&lt;li class="li1"&gt;Cluster Tomcat instances&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="p3"&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;b&gt;Best Practices thus Far&lt;/b&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
So here is a collection of the Chef "best practices" I have picked up in this first month. Given that it has only been a month, please take them with a grain of salt. Master Chefs, please don't hesitate to correct me if there is any incorrect information here.&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ul class="ul1"&gt;
&lt;li class="li2"&gt;If you want to get started quickly, i.e. learn chef in a weekend, use hosted chef and micro instances on EC2. For me it was important to install the entire stack before using it because that is the kind of geek I am. It also sucked up a lot of time.&lt;/li&gt;
&lt;li class="li2"&gt;Separate your ingredients (data) from your recipes. Don't hardcode your site-specific information like IP addresses or host names into the recipes. Put them in Data Bags, role attributes, or node attributes.&lt;/li&gt;
&lt;li class="li2"&gt;Data Bags are for complex or global data like users or samba shares&lt;/li&gt;
&lt;li class="li2"&gt;Role attributes and node attributes are best suited for simple values like host names for NTP servers, Nagios server, or whether to run X service as a independent daemon or under Xinted&lt;/li&gt;
&lt;li class="li2"&gt;If you aren't already familiar with git, you should make learning the basics of git your #2 priority after completing the Chef Getting Started Guide. Since we're talking about "Infrastructure as Code" here, you have to become as serious about version control as a software developer is.&lt;/li&gt;
&lt;li class="li2"&gt;After you clone the main chef repository, create the sub-folder site-cookbooks/ at the same level as cookbooks/ . Put your new cookbooks in site-cookbooks/ and make each one an individual git repository&lt;/li&gt;
&lt;li class="li2"&gt;In .gitignore, add ".chef" and "site-cookbooks". You store all authentication keys in your .chef/ so it is a directory that you really don't want to accidentally push to a public repository.&lt;/li&gt;
&lt;li class="li2"&gt;Sign the &lt;a href="https://secure.echosign.com/public/hostedForm?formid=PJIF5694K6L"&gt;CLA&lt;/a&gt; for Chef. You can't contribute fixes without doing so.&amp;nbsp;&lt;/li&gt;
&lt;li class="li2"&gt;Don't use &lt;i&gt;$ knife role edit &amp;lt;role-name&amp;gt;;&lt;/i&gt; use the Ruby DSL instead. That way you have your roles under version control.&lt;/li&gt;
&lt;li class="li2"&gt;Check, double-check, then ask on IRC before starting a cookbook from scratch. I wrote four different cookbooks before realizing that they duplicated functionality already present in the main &lt;a href="https://github.com/opscode/cookbooks"&gt;opscode/cookbooks&lt;/a&gt;&lt;/li&gt;
&lt;li class="li2"&gt;Use &lt;a href="http://wiki.opscode.com/display/chef/Shef"&gt;shef&lt;/a&gt;, it is a wonderful tool to debug and explore how Chef works. Note that it does not load roles attributes at this time.&lt;/li&gt;
&lt;li class="li2"&gt;Fat cookbooks, skinny recipes. You should put the recipes for both the client and server parts of an application in the same cookbook. This makes them easier to keep track of and forces you to make the recipes more modular.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="p2"&gt;
Here are some Ruby tips that I have picked up&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
Put&amp;nbsp; &lt;i&gt;require 'irb/completion'&lt;/i&gt; in your&amp;nbsp; ~/.irbrc, then you have auto completion in irb and in shef as it uses irb&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
For learning ruby, I actually prefer &lt;a href="http://rubygems.org/gems/pry"&gt;&lt;span class="s1"&gt;pry&lt;/span&gt;&lt;/a&gt; over irb, which reminds me of my beloved IPython. &amp;nbsp;I haven't yet figured out yet how to get shef to invoke pry rather than irb.&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
To install pry&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&amp;nbsp; &lt;i&gt;$ gem install pry pry-doc&lt;/i&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
You also have to put &lt;i&gt;require 'irb/completion'&lt;/i&gt; in your ~/.pryrc or type it in at the prompt. Here is an example of how tab completion works&lt;/div&gt;
&lt;/div&gt;
&lt;div class="p3"&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-aF9jAyXHKo0/TqxV5q03jtI/AAAAAAAAD0o/riE2M_DIWOQ/s1600/pry-term3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="187" src="http://3.bp.blogspot.com/-aF9jAyXHKo0/TqxV5q03jtI/AAAAAAAAD0o/riE2M_DIWOQ/s320/pry-term3.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p3"&gt;
The next step is to actually check the docs for what particular method does. The command for that is&lt;br /&gt;
&amp;nbsp; &amp;nbsp;pry&amp;gt;&lt;i&gt;&amp;nbsp;show-doc Object.method&lt;/i&gt;&lt;/div&gt;
&lt;div class="p4"&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-_WcsJwzGG2M/TqxVim5kmeI/AAAAAAAAD0Y/X9ozN2KTXBs/s1600/term-pry1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="226" src="http://1.bp.blogspot.com/-_WcsJwzGG2M/TqxVim5kmeI/AAAAAAAAD0Y/X9ozN2KTXBs/s320/term-pry1.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
You can also read ri docs by simply typing &lt;i&gt;pry&amp;gt; ri Class#method&lt;/i&gt; like you would at the normal shell prompt.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;
There are a couple tools that I intend to use in the near future, specifically &lt;a href="https://github.com/applicationsonline/librarian"&gt;libarian-chef&lt;/a&gt; by Jay Feldblum, but haven't yet gotten the opportunity.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="p1"&gt;
&lt;b&gt;More Pirate, Less Ninja&lt;/b&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
Chef has made a big impact on my work style. You definitely start working more like a developer, spending more time on your workstation and less SSH'd into a random machine. It is hard to justify heavily customizing your own dotfiles when you spend most of your time on random machines where the only text editor you can count on being present is vi.&amp;nbsp;&lt;a href="http://philosecurity.org/2009/03/23/pirates-and-ninjas-emacs-or-vi"&gt;&lt;span class="s1"&gt;This article&lt;/span&gt;&lt;/a&gt;&amp;nbsp;describes vi users as ninjas and emacs users as pirates but I think many of the same comparisons apply to sysadmins and developers. Ninjas can't carry much around with them on their dark forays just like sysadmins can't lug around a bloated .vimrc or .emacs file. Pirates, on the other hand, stay on their ships where they have plenty of room for whiskey, stolen treasure, ( .emacs.d/ || .vim.d/ ), .screenrc, .zshrc, etc.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
With Chef, I spend a lot more time working on cookbooks, roles, and data bags in &lt;i&gt;localhost:~/chef-repo/&lt;/i&gt;. Knife makes it very easy to manipulate your chef-server and chef-clients with fewer ssh console sessions. I think this work style may explain why there are many more emacs users in the chef-community than in your typical group of sysadmins. Historically, system administration has forced you to be a vi user but as a "chef" you can spend more time in emacs, sam, joe, or even *gasp* nano. I personally have heavily customized my .vimrc over the last month and even dabbled in zsh. I am not suggesting that Chef will turn you into an emacs user, but it will turn you into a pirate.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;b&gt;Selling it to the Team&lt;/b&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
Managers love chef. They get the idea in the first five minutes and ask you weren't using Chef five years ago. They love it because 1) big, respected companies are using it 2) it makes system configuration far more transparent, i.e. you can see how systems are actually configured and not how you hope they are 3) it will help them deal with the never-ending requests for new Virtual Machines coming from the developers. It can be harder to sell it to those sysadmins who may know *nix like the back of their hands but are used to doing &amp;nbsp;everything by hand and have never gotten into the habit of automating tasks with their own shell scripts. It can also be hard to sell to those sysadmins who have already invested heavily in their own custom bash/Perl/Python/Tcl infrastructure framework.&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
Here is my pitch for Chef in a nutshell.&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;A few years ago we had a ratio of &lt;/i&gt;&lt;b&gt;&lt;i&gt;n&lt;/i&gt;&lt;/b&gt;&lt;i&gt; machines per sysadmin. Now we have 3&lt;/i&gt;&lt;b&gt;&lt;i&gt;n&lt;/i&gt;&lt;/b&gt;&lt;i&gt; machines per admin. Next year we will likely have between 6-9&lt;/i&gt;&lt;b&gt;&lt;i&gt;n&lt;/i&gt;&lt;/b&gt;&lt;i&gt; machines per sysadmin. We are struggling mightily to support 3&lt;/i&gt;&lt;b&gt;&lt;i&gt;n&lt;/i&gt;&lt;/b&gt;&lt;i&gt; now and our current coping mechanisms will break down entirely when we move to 6&lt;/i&gt;&lt;b&gt;&lt;i&gt;n&lt;/i&gt;&lt;/b&gt;&lt;i&gt;. The only way we can cope is by moving from home-brewed infrastructure to a real configuration management system, such as Chef.&lt;/i&gt;&amp;nbsp;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;i&gt;If you aren't comfortable with writing your own automation scripts, you are at least comfortable using the scripts of others. I don't expect everybody here to be able write their own cookbooks from scratch but I believe everyone here can learn how to reuse and modify existing cookbooks to meet our needs.&lt;/i&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
Frankly, I don't yet have a way to sell Chef to the &lt;a href="http://en.wikipedia.org/wiki/Not_Invented_Here"&gt;&lt;span class="s1"&gt;NotInventedHere&lt;/span&gt;&lt;/a&gt; crowd. Whatever benefits you bring up, Chef still wasn't their idea. One option would be to convince them that Chef just does what they have been doing all along and using Chef will free them from maintenance work for their current tools. Then they can focus on what really needs reinventing. Unfortunately, implementing Chef may require a substantial amount of their help and not leave them so much time to start that new pet project.&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="p1"&gt;
&lt;b&gt;Thoughts on the Community&lt;/b&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
I feared that the Chef community would be populated with developers who were "slumming" as sysadmins. I found quite the opposite. The vast majority of the community are Unix-lovin', bash-spittin' geeks who make their careers as sysadmins and not as a side project. In terms of geography, the community is overwhelmingly concentrated in North America. It can be tough to get a response on IRC during the morning in Europe while you will get tens of responses during the US West Coast's working hours. For all hours outside of the European morning, you can find a large numbers of core developers on IRC and they are extremely helpful.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
The vast majority of chef users seem to work on Ubuntu, with Enterprise Linux a distant second. Surprisingly, there is a relatively large presence of OpenSolaris/Ilumos and I am not sure exactly why that is. Perhaps Solaris users are disproportionately drawn to automation tools?&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
When I can't get a quick answer on IRC, the two best channels are the 1) chef-users mailing list and 2) twitter. For some reason, the devops world has really, really gathered around twitter. I can get a quick answer at any hour by using the hashtag #opschef. However, this only works for questions that entirely fit into 110 characters. It is bad form to link to a mailing list post or extend the question across multiple tweets. For complicated questions, the mailing list is always the best place to go for help.&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
The community is extremely friendly and so far there are no trolls. However, this is typical of a young project. Early adopters by their nature tend to be more positive and self-sufficient. Most people on #chef are there because they discovered chef on their own and not because their boss mandated they use it.&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;b&gt;My Short-Term Chef Wishlist&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
Here is my wishlist for the next 3-6 months&lt;/div&gt;
&lt;ul class="ul1"&gt;
&lt;li class="li2"&gt;Clear guidelines on how to collaborate on cookbooks and on how to push changes upstream to opscode/cookbooks (something which &lt;a href="http://twitter.com/#!/jtimberman"&gt;jtimberman&lt;/a&gt; is already working on)&lt;/li&gt;
&lt;li class="li2"&gt;Lower Memory Usage. Chef can really, really be a memory hog when you have several hundred nodes&lt;/li&gt;
&lt;li class="li2"&gt;Better support for Enterprise Linux, both in core chef and the cookbooks&lt;/li&gt;
&lt;li class="li2"&gt;A few weeks ago I would have said better documentation but they have already made huge strides in this regard&lt;/li&gt;
&lt;li class="li2"&gt;A stronger connection to the FOSS community worldwide&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="p2"&gt;
Chef will achieve world domination when the installation instructions for the average software application start not by pointing to a .rpm, .deb, or tarball but to a Chef cookbook. Key to achieving that are 1) making Chef awesome (of course) and 2) better engagement with the communities that manage software packaging in the public sphere--the FOSS geeks. These guys are the guerilla foot soldiers of software packaging. They write the man pages, manage a FOSS project's build servers, maintain wikis, etc. The phenomena of "cloud computing" couldn't exist today if it weren't for all their hard work at every layer of the GNU/Linux/*BSD stacks.&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
How can Chef win over the FOSS geeks? First, having a presence at conferences like &lt;a href="http://fosdem.org/"&gt;&lt;span class="s1"&gt;FOSDEM&lt;/span&gt;&lt;/a&gt;, &lt;a href="http://2011.osidays.com/"&gt;&lt;span class="s1"&gt;OSI&lt;/span&gt;&lt;/a&gt;, &lt;a href="http://fedoraproject.org/wiki/FUDCon"&gt;&lt;span class="s1"&gt;FUDCON&lt;/span&gt;&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/FISL"&gt;&lt;span class="s1"&gt;FISL&lt;/span&gt;&lt;/a&gt;, etc. would be relatively inexpensive and give them a lot of bang for their buck.&amp;nbsp;Secondly, offering some version of free hosted chef for up to &lt;i&gt;n&lt;/i&gt; nodes for open-source projects and foundations like &lt;a href="http://www.softwarefreedom.org/"&gt;&lt;span class="s1"&gt;Software Freedom Law Center&lt;/span&gt;&lt;/a&gt;, &lt;a href="http://www.python.org/psf/"&gt;&lt;span class="s1"&gt;Python Software Foundation&lt;/span&gt;&lt;/a&gt;,&amp;nbsp;&lt;a href="http://sfconservancy.org/"&gt;&lt;span class="s1"&gt;Software Freedom Conservancy&lt;/span&gt;&lt;/a&gt;, etc.&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
&lt;b&gt;Wrapping up&lt;/b&gt;&lt;/div&gt;
&lt;div class="p1"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="p2"&gt;
So far, Chef has lived up to the hype. It has made me more productive in a relatively short amount of time. I can't imagine my future as a sysadmin without it. Configuration management--whether using chef, puppet, or other--will soon be an essential skill for a professional system administrator. Now how does Chef affect my work in the larger context of Devops? Where does it fit in my devops-toolchain? Well, those are subjects for another blog post entirely.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://news.ycombinator.com/item?id=3174290"&gt;Comments for this post&lt;/a&gt; are on Hacker News&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Devopsanywhere/~4/4MKZHIKVAiE" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/2661785546577878625?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/2661785546577878625?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Devopsanywhere/~3/4MKZHIKVAiE/month-with-chef.html" title="A Month with Chef" /><author><name>Bryan Berry</name><uri>https://plus.google.com/106664679333642993534</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-TyULMG7ZA6A/AAAAAAAAAAI/AAAAAAAAAAA/wjGutwhuhAU/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-aF9jAyXHKo0/TqxV5q03jtI/AAAAAAAAD0o/riE2M_DIWOQ/s72-c/pry-term3.png" height="72" width="72" /><feedburner:origLink>http://devopsanywhere.blogspot.com/2011/10/month-with-chef.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8DQ387eip7ImA9WhNVGEw.&quot;"><id>tag:blogger.com,1999:blog-1083699665345453745.post-7581721509146540042</id><published>2011-10-16T02:22:00.000-07:00</published><updated>2012-12-29T12:44:32.102-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-29T12:44:32.102-08:00</app:edited><title>Why Chef?</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="text-align: left;" trbidi="on"&gt;
Being a system administrator is alternately thrilling and tedious. The thrilling part is setting up an awesome, rock-solid system. The tedious part is doing that 10 or even 100 times more. Further, throughout your career you will configure certain applications again and again. You know the ones, sendmail, apache, samba, etc. Well, there have been many attempts to build a framework, an abstraction, for automating the process of configuring these well-worn tools and others. Today there is one such framework that finally gets it right, &lt;a href="http://wiki.opscode.com/display/chef/Home"&gt;Chef&lt;/a&gt;. There are many, many reasons to use Chef but the&amp;nbsp;main reason you should use chef is this: &lt;b&gt;You&lt;/b&gt;, System Administrator, are too damn smart to spend the rest of your professional life reinventing the wheel.&lt;br /&gt;
&lt;br /&gt;
Let me tell you a little more about how wonderful Chef is, then I will show you briefly some technical highlights, and finally I will clear up some Chef myths.&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;The Top 5 Reasons to use Chef&lt;/span&gt;&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;Writing reams of documentation sucks. Chef drastically reduces the amount of documentation you have to write.&lt;/li&gt;
&lt;li&gt;Bash doesn't scale. Seriously.&lt;/li&gt;
&lt;li&gt;Technical Awesomeness&lt;/li&gt;
&lt;li&gt;Chef grows with you&lt;/li&gt;
&lt;li&gt;You can stop reinventing the wheel&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Now let's talk about that awesomeness in more detail.&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Write Less Documentation&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Less docs? You're kidding me right? Actually, I'm not. If you're like me, you'r sick of annotating the your entire bash history. If you're not like me, you don't even bother. With Chef, your infrastructure literally is code rather than a collection of unique artifacts. Top-level readmes and a few well-placed code comments should be sufficient. Take a look at this recipe for a basic sendmail configuration.&lt;/div&gt;
&lt;br /&gt;
basic sendmail configuration with chef&lt;br /&gt;
&lt;script src="https://gist.github.com/1290564.js"&gt;
 
&lt;/script&gt;
&lt;div class="gistLoad" data-id="1290564" id="gist-1290564"&gt;Loading ....&lt;/div&gt;

&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Bash Doesn't Scale
&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Bash is a wonderful thing, but like all UNIX tools, it is fundamentally limited by design. Bash doesn't have a code reuse mechanism more powerful than functions. It uses a single global namespace. These and other limitations have made it hard for us sysadmins to reuse and generalize our shell scripts across different distributions, let alone different versions of *nix. Lastly, it is quite difficult to write shell scripts that are idempotent, that is, they have the same effect whether run once or 100 times. This is particularly true when manipulating configuration files. Let's take a look at how you would configure /etc/sudoers with chef.&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1290581.js"&gt;
 
&lt;/script&gt;
&lt;div class="gistLoad" data-id="1290581" id="gist-1290581"&gt;Loading ....&lt;/div&gt;

&lt;br /&gt;
All the variables in this template are passed in from &lt;a href="https://github.com/opscode/cookbooks/blob/master/sudo/recipes/default.rb"&gt;this recipe&lt;/a&gt;.&lt;b&gt;&amp;nbsp;&lt;/b&gt;If you think you can replicate this template using sed, please submit it as a comment so we can compare results.&lt;br /&gt;
&lt;br /&gt;
Last but not least, Bash can be just as unreadable and obfuscated as the darkest perl code. With Chef you have a high level, intuitive&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Domain-specific_language"&gt;DSL&lt;/a&gt; for describing your configuration. Remember what I said about needing less documentation?&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Technical Awesomeness&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;NOSQL FTW&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
One of the virtues that many *nix tools share is that they store their configurations in text files rather than binary formats or in a database. Chef stores your system configurations in text and in a database. It accomplishes this by using the document-oriented database, &lt;a href="http://couchdb.apache.org/"&gt;CouchDB&lt;/a&gt;.&amp;nbsp;This makes the configuration &amp;nbsp;searchable and higher performance. One of my annoyances with nagios is that I have to restart it every time I change any service or host. &amp;nbsp;There are no annoying restarts with Chef. Each Configuration change you make takes effect instantly. Further you can use your favorite text editor and the command line to make configuration changes. Finally, using a database means that Chef is easily accessed through a GUI. We sysadmins often look down on GUIs as crutches for the Windows crowd. The Chef web UI is excellent for visualizing your own infrastructure, something that is hard to do while staring at plain text.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Knowing is Half the Battle&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Chef uses &lt;a href="http://wiki.opscode.com/display/chef/Ohai"&gt;Ohai&lt;/a&gt; to collect data about your system. Your recipes can access these attributes and make decisions based on them. For example, you can determine which version of Red Hat you are using simply by looking up the value of &lt;i&gt;node['platform_version']&lt;/i&gt;. You don't have to &lt;i&gt;cat | grep | awk&lt;/i&gt; to find out which release you are on.&lt;br /&gt;
&lt;br /&gt;
Ohai makes cookbooks more dynamic and able to support different distributions. As we will see later, this is one of the reasons there are so many high-quality cookbooks available.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Search
&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Search is a feature in Chef Server that allows you to query the configuration information of all other servers and of &lt;a href="http://wiki.opscode.com/display/chef/Data+Bags"&gt;globally-defined databags&lt;/a&gt;. This allows you to do things like configure clusters where a&amp;nbsp;member of cluster needs to know not only about its own configuration but about the configurations of the other members of the cluster.&lt;br /&gt;
&lt;br /&gt;
Example of using search with data bags. For the full recipe go &lt;a href="https://github.com/opscode/cookbooks/blob/master/users/recipes/sysadmins.rb"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;script src="https://gist.github.com/1290657.js"&gt;
 
&lt;/script&gt;
&lt;div class="gistLoad" data-id="1290657" id="gist-1290657"&gt;Loading ....&lt;/div&gt;

&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Knife
&lt;/b&gt;&lt;br /&gt;
&lt;a href="http://wiki.opscode.com/display/chef/Knife"&gt;Knife&lt;/a&gt; is one of the truly great command line tools. It is your primary mechanism for interacting with the chef-server. Knife shares many usage patterns with git. If you love git, you'll love knife.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;shef&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://wiki.opscode.com/display/chef/Shef"&gt;shef&lt;/a&gt; works the way you work, in an iterative manner. Most of us system administrators are self-taught and we learn best by doing. Fire up shef and you can on the fly play with attributes and create recipes. Further, you can connect to your server and download the cookbooks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Chef Grows with You&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Chef uses pure &lt;a href="http://ruby-lang.org/"&gt;Ruby&lt;/a&gt; as its configuration language, not a shackled subset of ruby, nor yet another custom configuration language.&amp;nbsp;You only have to learn a &lt;a href="http://wiki.opscode.com/display/chef/Just+Enough+Ruby+for+Chef"&gt;small amount of ruby&lt;/a&gt; to get started with chef. Once you get beyond the basics of Chef, you can go farther with Ruby. Many of you are grumbling now because ruby sucks to compared to Perl/Python/TCL/&amp;lt;insert-interpeted-language-here&amp;gt;. Well, Ruby may pale in comparison to Python but it is still a powerful, full-featured language.&lt;br /&gt;
&lt;br /&gt;
Just like Perl, there is a lot of dark magic inside Ruby. It can't be used carelessly or it will bite you in the ass. Unlike Python, Ruby does not make it difficult to do the wrong thing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;You can stop reinventing the wheel&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Until Chef, we sysadmins did not have a truly modular way to abstract and share our system configurations. Please stop reading and&amp;nbsp;browse&amp;nbsp;&lt;a href="http://community.opscode.com/cookbooks"&gt;http://community.opscode.com/cookbooks&lt;/a&gt;. Later on, you should look at the code in &amp;nbsp;&lt;a href="https://github.com/opscode/cookbooks"&gt;https://github.com/opscode/cookbooks&lt;/a&gt;. You will discover that some turncoat sysadmins are giving away our trade secrets. Now is the time for you to do the same. In fact, you can rip out a large chunk of your shell scripts and replace them with Chef cookbooks. You will find that many existing recipes meet your requirements and you can easily add new recipes to existing cookbooks for your unmet requirements.&lt;br /&gt;
&lt;br /&gt;
Recently, I replaced a 500 line shell script with 7 cookbooks, 5 reused from community.opscode.com and 2 new ones written from scratch. In the process of replacing the shell script I actually wrote 4 cookbooks that unwittingly duplicated the functionality of existing cookbooks.&lt;br /&gt;
&lt;br /&gt;
The emergence of the cloud-computing, whether on the public cloud such as EC2 or internally with &lt;a href="http://www.openstack.org/"&gt;openstack&lt;/a&gt;, means that we systems administrators will have to manage at least 10 times more systems. We have to become 10 times more productive. We have to shift from "managing servers" to "managing configurations." Chef is one of key tools to accomplishing this.&lt;br /&gt;
&lt;br /&gt;
&lt;b style="font-weight: bold;"&gt;One Big Fat Chef Caveat&lt;/b&gt;&lt;br /&gt;
&lt;b style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
Chef makes good sysadmins more productive. It does not turn junior sysadmins into experts. In fact, it makes them more dangerous. As I overheard on IRC one day, "Chef is to sysadmins what C++ is to software engineering." This is very true.&amp;nbsp;You can automate system configurations with off-the-shelf cookbooks but you have to understand exactly what they do and test them very rigorously.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;b&gt;Chef Myths&lt;/b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
There are a few myths about Chef floating around the intertubes that need to be exploded. The biggest one is that you have to be a professional programmer to use Chef. This is untrue for a couple of reasons, including the assumption that system administrators don't program already. Writing complex shell scripts is programming. Creating Apache rewrite rules is quite close to programming.&amp;nbsp;Further, Chef doesn't require you to be a Rubyist to get started, just as you don't have to be a Bash Hacker to use the command line. Take a look at &lt;a href="http://devopsanywhere.blogspot.com/2011/10/stupid-simple-chef-tutorial-for-dirty.html"&gt;this tutorial&lt;/a&gt; and you will see what I mean.&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: left;" trbidi="on"&gt;
I hear murmurs now and then that Chef is "insecure" because the recipes are executed on the chef-client &amp;nbsp;rather than on the chef-server. I argue that chef is more secure because of this. If recipes were executed on the chef-server, there would be a risk that a single malignant recipe modified other recipes to turn your entire network into a botnet. This would turn your chef-server into a single point of failure and make it a powerful attack vector.&lt;/div&gt;
&lt;div style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: left;" trbidi="on"&gt;
Finally, some will argue that Chef sucks because every server you configure should be hand-crafted and beautifully unique in its own way. If you believe that, perhaps you should go into the virtual performance art and get out of the business of making the Internet awesome.&lt;/div&gt;
&lt;div style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Wrapping Up&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Chef is a truly powerful tool that every serious system administrator should consider using. It offers immense personal and professional benefits.&lt;br /&gt;
&lt;br /&gt;
Please post comments on &lt;a href="http://news.ycombinator.com/item?id=3117284"&gt;Hacker News&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Marcus van Dam (m4rcu5) helped edit this post&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;Note: The title of this post is a reference to Eric S. Raymond's great post "&lt;a href="http://www.linuxjournal.com/article/3882"&gt;Why Python?&lt;/a&gt;" which inspired me to learn Python, a long, long time ago.&lt;/i&gt;&lt;/div&gt;
&lt;b&gt;
&lt;/b&gt;&lt;/div&gt;
&lt;script src="https://raw.github.com/moski/gist-Blogger/master/public/gistLoader.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;img src="http://feeds.feedburner.com/~r/Devopsanywhere/~4/O9gXm_LzOZs" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/7581721509146540042?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/7581721509146540042?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Devopsanywhere/~3/O9gXm_LzOZs/why-chef.html" title="Why Chef?" /><author><name>Bryan Berry</name><uri>https://plus.google.com/106664679333642993534</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-TyULMG7ZA6A/AAAAAAAAAAI/AAAAAAAAAAA/wjGutwhuhAU/s512-c/photo.jpg" /></author><feedburner:origLink>http://devopsanywhere.blogspot.com/2011/10/why-chef.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE4GRnY9eyp7ImA9WhNVGEw.&quot;"><id>tag:blogger.com,1999:blog-1083699665345453745.post-9112587608076747911</id><published>2011-10-09T07:46:00.000-07:00</published><updated>2012-12-29T12:28:47.863-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-29T12:28:47.863-08:00</app:edited><title>Puppet vs. Chef, Fight!</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;i&gt;Update: see &lt;a href="http://blog.loof.fr/2011/10/puppet-vs-chef-fight.html"&gt;Puppet vs. Chef&lt;/a&gt; en francais, not a translation but an original article inspired by this one&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
If you aren't yet using Puppet or Chef for managing your *nix infrastructure, you should seriously consider it. The benefits are enormous. Frankly, I don't think you __can__ manage a modern infrastructure without using Puppet, Chef, or reinventing a configuration management framework with your own custom scripts. However, you can't use both Chef and Puppet together, so which should you choose?&lt;br /&gt;
&lt;br /&gt;
If you're like me, you obsess over tool choices. You agonize for weeks over these decisions. Why? Because you will end up putting a huge personal investment in the chosen tool.&amp;nbsp;There isn't all that much on the relative benefits of Puppet vs. Chef besides this &lt;a href="http://www.quora.com/What-are-the-key-reasons-to-choose-Puppet-over-Chef-or-vice-versa"&gt;quora thread&lt;/a&gt;. Below you will find my completely subjective, non-comprehensive study of the matter. TL;DR, Chef wins but by only a narrow margin.&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;The Criteria&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;Community Strength&lt;/li&gt;
&lt;li&gt;Leadership&lt;/li&gt;
&lt;li&gt;Corporate Adoption&lt;/li&gt;
&lt;li&gt;Technical Merits&lt;/li&gt;
&lt;li&gt;Hands-on Experience&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Community Strength&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Community Size&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Number of people on IRC on Sunday Oct 9th, 2011 10 AM GMT&lt;br /&gt;
#puppet &amp;nbsp; 541 users&lt;br /&gt;
#chef &amp;nbsp; &amp;nbsp; &amp;nbsp; 233 users&lt;br /&gt;
&lt;br /&gt;
Mailing Lists&lt;br /&gt;
puppet-users &amp;nbsp;3363 members, 5961 topics&lt;br /&gt;
chef: 600 members, # of topics unknown&lt;br /&gt;
&lt;br /&gt;
Regarding IRC, Chef seems much more U.S.-centric. It can be hard to get answers during the European workday. The situation is probably better for Asian users as they can catch the North American community when it is early evening on the West Coast of the United States. That is not true for Puppet, where you can get an answer at any time of day or night. R.I. Pienaar is based in London and seems to be on IRC at all hours. Somehow he manages to kick out awesome code and be continuously available.&amp;nbsp;Further, James Turnbull doesn't seem to sleep either and is incredibly helpful.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Quality of Cookbook Sites&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://community.opscode.com/cookbooks"&gt;http://community.opscode.com/cookbooks&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://forge.puppetlabs.com/"&gt;http://forge.puppetlabs.com/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Github Repositories:&lt;br /&gt;
puppet:&amp;nbsp;&amp;nbsp;&lt;a href="https://github.com/search?q=puppet"&gt;1622 repositories&lt;/a&gt;&lt;br /&gt;
chef: &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href="https://github.com/search?q=chef"&gt;1299 repositories&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
While Chef is much younger project than Puppet, it is really impressive how many cookbooks there are and their respective quality, especially when Chef is less than half the age of Puppet. From what I can tell, most people bypass the community sites and go straight to github to find their Chef cookbooks or puppet modules.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Documentation, Official and Informal&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Both Puppet and Chef have excellent reference documentation. In my opinion, the Puppet docs help you get up and running much faster. &lt;a href="http://www.amazon.com/Pro-Puppet-James-Turnbull/dp/1430230576/ref=pd_sim_b1"&gt;Pro Puppet&lt;/a&gt;, by Puppet Labs engineer James Turnbull, is an awesome introduction to Puppet. I found it immensely helpful. There is a 50-page O'Reilly publication on Chef, &lt;a href="http://www.amazon.com/Test-Driven-Infrastructure-Chef-Stephen-Nelson-Smith/dp/1449304818/ref=sr_1_1?ie=UTF8&amp;amp;qid=1318151239&amp;amp;sr=8-1"&gt;Test-Driven Infrastructure with Chef&lt;/a&gt;, but it cannot match the breadth of Pro Puppet.&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #222222;"&gt;&amp;nbsp;I have heard that O'Reilly are going&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #222222;"&gt;to be publishing a feature-length definitive guide, scheduled to be&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #222222;"&gt;out by the Summer of 2012.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The Chef community definitely tends more towards programmers and rubyists than systems administrators. I think that puppet meets the needs of the majority of its users so well that they never try Chef.&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Leadership&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
We all know that leaders can make or break open-source projects. The BDFL's personality shapes the project more than the actual code. What would linux be without Linus Torvalds' stewardship?&amp;nbsp;I am wary to bet against Puppet founder Luke Kanies. He is both a genius and a visionary. He reminds me a little of &lt;a href="http://en.wikipedia.org/wiki/Steve_Jobs"&gt;another Reed College alumnus&lt;/a&gt;. I highly recommend listening to&amp;nbsp;&lt;a href="http://devopscafe.org/show/2010/12/20/episode-17.html"&gt;Luke Kanies interview&lt;/a&gt;&amp;nbsp;on DevOps Cafe. He shows himself to be very intelligent and very opinionated. My understanding is that his original motivation for creating Puppet was to make life better for the average sysadmin.&lt;br /&gt;
&lt;br /&gt;
The resumes of the Opscode team are just amazing. CTO Chris Brown and co-founder Jesse Robbins were core infrastructure engineers at Amazon, the company that perhaps more than any other understands how to manage infrastructure at scale. Listen to co-founder&amp;nbsp;&lt;a href="http://devopscafe.org/show/2011/9/20/devops-cafe-episode-19.html"&gt;Jesse Robbin's Interview&lt;/a&gt;&amp;nbsp;and you will find him to be very pragmatic about infrastructure and less opinionated than Luke. His motivation was to create an open-source tool that solved the kinds of infrastructure problems he dealt with while working at Amazon.com.&lt;br /&gt;
&lt;br /&gt;
On the funding side, both companies have closed substantial Series B funding rounds. We're talking more that 10 million dollars each. Both of these companies can throw a number of talented software engineers at the devops problem domain for a while to come.&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Corporate Adoption&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
I believe that both Puppet and Opscode corporations will become extremely successful.&amp;nbsp;Jesse Robbins explains this best in &lt;a href="http://www.virtual-strategy.com/2011/09/30/qa-jesse-robbins-opscode"&gt;Virtual Strategy Magazine&lt;/a&gt;.&lt;br /&gt;
&lt;blockquote&gt;
&lt;span class="Apple-style-span" style="background-color: white; font-family: 'Lucida Grande', Tahoma, Helvetica, sans-serif; font-size: 13px; line-height: 19px;"&gt;&amp;nbsp;Our primary competitor is the in-house, home-grown tooling that every systems engineer has had to cobble together to deal with their legacy environments. That’s our principal competitor.&amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;
That's right. The biggest competitor to Chef and Puppet isn't each other but that hairball nest of Bash and Perl that holds your data center together.&lt;br /&gt;
&lt;br /&gt;
Still, Puppet has an amazing customer list but Chef is also racking up wins.&amp;nbsp;If &lt;a href="http://puppetlabs.com/puppet/puppet-enterprise/"&gt;Puppet Enterprise 2.0&lt;/a&gt; delivers half of what its press release promises, it will be a huge success. Puppet Enterprise's integration with &lt;a href="http://puppetlabs.com/mcollective/introduction/"&gt;mcollective&lt;/a&gt; is particularly exciting.&lt;br /&gt;
&lt;br /&gt;
I am particularly impressed that a number of companies have built their own internal provisioning tools on top of Chef, notably Rackspace Cloud Builders and Dell's Openstack team.&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Technical Merits&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Puppet is designed to be approachable by systems administrators. It is not necessarily written to empower rubyists.&amp;nbsp;Writing Puppet manifests, at least initially, feels much like writing nagios or apache configurations. However, it starts feeling much like programming once you get beyond simple resource specification.&lt;br /&gt;
&lt;br /&gt;
Chef is designed to help engineers manage the configuration of their infrastructure at scale. It does not have the same focus on easy-of-use, nor is it as opinionated as Puppet. Now let's look at a few salient features.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Here are examples of how to create a user in first Puppet and then chef
&lt;br /&gt;
&lt;script src="https://gist.github.com/1273747.js"&gt;
&lt;/script&gt;
&lt;div class="gistLoad" data-id="1273747" id="gist-1273747"&gt;Loading ....&lt;/div&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1273755.js"&gt;
&lt;/script&gt;
&lt;div class="gistLoad" data-id="1273755" id="gist-1273755"&gt;Loading ....&lt;/div&gt;

&lt;br /&gt;
They don't look terribly different, but now let's throw some Ruby into the mix. In the following example, I iterate through a list of users stored in a data bag
&lt;br /&gt;
&lt;br /&gt;
&lt;script src="https://gist.github.com/1273758.js"&gt;
&lt;/script&gt;
&lt;div class="gistLoad" data-id="1273758" id="gist-1273758"&gt;Loading ....&lt;/div&gt;

&lt;br /&gt;
Now you should have a better sense of the difference between Puppet and Chef.&amp;nbsp;Some may have a valid criticism that Chef lets you do too much by allowing you use regular Ruby. I have to admit that undisciplined use of Ruby is as dangerous if not more dangerous as perl or bash abuse. At the same time, it is quite empowering. The Chef community really needs some kind of chef-lint tool to tell you when you're doing something you shouldn't.&lt;big&gt;&lt;b&gt;Update:&lt;/b&gt;&lt;/big&gt; &lt;a href="https://github.com/acrmp/foodcritic"&gt;Foodcritic&lt;/a&gt; now excellently fills that need.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Debugging&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I miss noop mode in puppet, though this is on the way for Chef. It is a wonderful way to see how your puppet configuration differs from what is actually on disk without actually changing anything. I have heard some refer to noop mode as "Lie to me mode" though I have yet to have it bite me in the ass. I might feel very differently if I had experienced that personally. I also liked how puppet spit out the text of rendered templates to the console. Maybe you can do this with Chef as well, but I haven't figured out how to yet.&lt;big&gt;&lt;b&gt;Update:&lt;/b&gt;&lt;/big&gt;Chef now has the equivalent of noop mode with its why-run mode.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Chef's Secret Sauce&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Chef's&amp;nbsp;&lt;a href="http://wiki.opscode.com/display/chef/Data+Bags"&gt;Data Bags&lt;/a&gt;&amp;nbsp;are incredibly useful. They are a very nice way to feed lists of users to multiple cookbooks. Think of them as global variables for your chef-server. One the benefits of data bags is that they allow you to separate your corporate information from your cookbooks. Thus, making it easier for Chef users to open-source their cookbooks. Puppet has extlookup but that is quite a bit more limited than data bags.&amp;nbsp;It looks like Puppet maybe getting something similar to data bags with&amp;nbsp;&lt;a href="http://wiki.opscode.com/display/chef/Data+Bags"&gt;Hiera&lt;/a&gt;.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I also have to praise the &lt;a href="http://wiki.opscode.com/display/chef/Search"&gt;Search&lt;/a&gt; function. It is an extemely intuitive way to to tie together dependencies between nodes, such as between a nagios server and its clients. Puppet has a way to "export" resources but I could never get my head around how that worked.&lt;/div&gt;
&lt;br /&gt;
In my experience, Chef has a more powerful read-eval-print-loop (&lt;a href="http://wiki.opscode.com/display/chef/Shef"&gt;shef&lt;/a&gt;) than Puppet does. I use shef quite frequently and I cannot understate its helfulness. Puppet does not have a similar repl as far as I am aware.&lt;br /&gt;
&lt;br /&gt;
Server-side, Chef is much more complex but also seems to be better thought out. I love the fact that Chef uses a document-oriented database. This combines the benefits of using files to store your configuration (easy to understand) with the benefits of using a database (speed).&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Hands-On&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
I don't believe there are many in the Puppet community that have extensively experimented with Chef before choosing Puppet. There are many in the Chef community that have worked previously with Puppet and found that it did not meet their needs.&lt;br /&gt;
&lt;br /&gt;
I started working with Puppet in June of this year and quickly fell in love. I read Pro Puppet and did all the exercises. Next I set to rewriting my 400 line linux provisioning script in puppet manifests. At first it &amp;nbsp;went well but then things got more complicated. I kept tripping over the DSL's syntax and was surprised that there weren't more puppet modules in puppetforge or github. I felt that I had to learn both the Puppet DSL and Ruby to really to be effective with Puppet. I started thinking that the grass might be greener on the other side.&lt;br /&gt;
&lt;br /&gt;
Two things convinced me to try out Chef. The first was the announcements by&amp;nbsp;&lt;a href="https://github.com/dellcloudedge/crowbar"&gt;Dell&lt;/a&gt;&amp;nbsp;and Rackspace that they had built there Openstack provisioners on top of Chef. If the people pioneering devops chose to build their platform &lt;i&gt;on top of&lt;/i&gt; Chef, then it definitely deserved my attention. The next was&amp;nbsp;&lt;a href="http://devopscafe.org/show/2011/9/20/devops-cafe-episode-19.html"&gt;Jesse Robbins' interview&lt;/a&gt;&amp;nbsp;on DevopsCafe. He made all the action in the Chef community sound so exciting that I had to go check it out for myself.&lt;br /&gt;
&lt;br /&gt;
It took me three days to get Chef Server up and running on RHEL 5.7.&amp;nbsp;Next, I started writing my own cookbooks. Now I have nearly converted that linux provisioning script to a cookbook. Not counting the time it took me to set up the server, it took me roughly half the time it took with Puppet.&lt;br /&gt;
&lt;br /&gt;
It was easy to get started with Puppet, but things became more complicated with time. With Chef I am having the opposite experience.&amp;nbsp;Again, the single biggest drawback to Chef is that it has a steeper learning curve than Puppet. Further, most of the existing tutorials focus on the deeper concepts in Chef rather than giving novices quick gratification. To this end, I have started the&amp;nbsp;&lt;a href="http://devopsanywhere.blogspot.com/2011/10/stupid-simple-chef-tutorial-for-dirty.html"&gt;"Dirty Chef"&lt;/a&gt;&amp;nbsp;series of tutorials.&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Summary&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Final Scorecard&lt;/u&gt;&lt;br /&gt;
Community &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-- &amp;nbsp;Puppet wins&lt;br /&gt;
Leadership &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -- &amp;nbsp;Draw&lt;br /&gt;
Corporate Adoption -- &amp;nbsp;Draw&lt;br /&gt;
Technical Merits &amp;nbsp; &amp;nbsp; &amp;nbsp;-- &amp;nbsp;Chef&lt;br /&gt;
Hands-On &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-- &amp;nbsp;Chef&lt;br /&gt;
&lt;br /&gt;
According to this non-scientific criteria, Chef is the better tool. In my humble opinion, Chef is technically superior. Don't buy the argument "Chef requires you to be a programmer, Puppet doesn't."&amp;nbsp;While Puppet is geared towards non-programmers, it becomes regular programming once you do anything moderately complicated.&amp;nbsp;That's when Puppet's DSL becomes more of a liability than an asset and where Chef really shines. Now while chef is the winner of my little bake-off, it is not without faults. Puppet has far better support for RHEL/Centos and it does have a larger, more responsive community.&lt;br /&gt;
&lt;br /&gt;
Dear Puppet community, please know that I write this blog post with great ambivalence and I still love you. Jame Turnbull and R.I. Pienaar, thanks for all your help via IRC, Twitter, and the mailing list. Puppet Labs is developing a toolchain that is much larger than just the puppetmaster. This toolchain may turn out to be superior to what Opscode and its respective partners come up with.&lt;br /&gt;
&lt;br /&gt;
On a final note, please know that both of these tools are good enough for configuration management and are only one part of a larger &lt;a href="https://groups.google.com/forum/#!forum/devops-toolchain"&gt;toolchain&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
P.S. I will delete any comments that trash either Puppet or Chef. They are both excellent tools, built by&lt;br /&gt;
visionaries.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Most of the discussion related this article seems to be happening on &lt;a href="http://news.ycombinator.com/item?id=3090800"&gt;Hacker News&lt;/a&gt;.&lt;/i&gt;&lt;/div&gt;
&lt;script src="https://raw.github.com/moski/gist-Blogger/master/public/gistLoader.js" type="text/javascript"&gt;&lt;/script&gt;&lt;img src="http://feeds.feedburner.com/~r/Devopsanywhere/~4/qshkqi8Puy8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://devopsanywhere.blogspot.com/feeds/9112587608076747911/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://devopsanywhere.blogspot.com/2011/10/puppet-vs-chef-fight.html#comment-form" title="34 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/9112587608076747911?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/9112587608076747911?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Devopsanywhere/~3/qshkqi8Puy8/puppet-vs-chef-fight.html" title="Puppet vs. Chef, Fight!" /><author><name>Bryan Berry</name><uri>https://plus.google.com/106664679333642993534</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-TyULMG7ZA6A/AAAAAAAAAAI/AAAAAAAAAAA/wjGutwhuhAU/s512-c/photo.jpg" /></author><thr:total>34</thr:total><feedburner:origLink>http://devopsanywhere.blogspot.com/2011/10/puppet-vs-chef-fight.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D04CQHg9cSp7ImA9WhdbE08.&quot;"><id>tag:blogger.com,1999:blog-1083699665345453745.post-2643145307113580497</id><published>2011-10-07T00:55:00.000-07:00</published><updated>2011-10-11T02:39:21.669-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-11T02:39:21.669-07:00</app:edited><title>A Stupid, Simple Chef Tutorial for Dirty, Lazy Fry Cooks (Like Me) Part I</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;i&gt;disclaimer: I am not a chef expert. To really learn chef, you need to go to the &lt;a href="http://wiki.opscode.com/display/chef/Home"&gt;wiki&lt;/a&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
I really like the &lt;a href="http://wiki.opscode.com/display/chef/Home"&gt;chef&lt;/a&gt; documentation, I really do. It is an excellent reference. It is the devops equivalent of the manual they must use at the &lt;a href="http://www.cordonbleu.edu/"&gt;Le Cordon Bleu&lt;/a&gt; cooking school. But I have to admit that sometimes I am just a dirty, lazy fry cook, especially when playing with a new technology. I want instant gratification or at least in under 30 minutes. &amp;nbsp;What I love about the Puppet documentation, is that it gets &lt;a href="http://docs.puppetlabs.com/learning/manifests.html"&gt;you started quickly&lt;/a&gt;, before you begin optimizing and modularizing and all that other crap that good devops chefs do. To that end, I have created a &lt;a href="https://github.com/bryanwb/dirty-chef"&gt;chef repository&lt;/a&gt; that is exactly what you shouldn't do in production but is hopefully useful for learning.&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;In this tutorial,&amp;nbsp;&lt;span class="Apple-style-span" style="background-color: #f8f8f8; line-height: 20px;"&gt;I am going to use chef-solo for the purpose of the tutorial. Chef-solo simply means running chef with out connecting to central chef server that provides you with cookbooks and some other functionality. Chef-server is awesome but currently a pain in the butt to set up. I am also going to use RHEL 6.0 but you can use CentOS.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large; line-height: 20px;"&gt;Why Chef?&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="line-height: 20px;"&gt;If you aren't yet using configuration management with Chef, Puppet, or similar tool you're just plain &lt;b&gt;doing it wrong&lt;/b&gt;. I'm doing it wrong. I cobble together my infrastructure with a combination of kickstart, &amp;nbsp;bash scripts, &lt;a href="http://fabfile.org/"&gt;fabfiles&lt;/a&gt;, and random python. But the diversity of applications I support and the sheer number of virtual machines are increasing rapidly. My agglomeration of virtual glue and duct tape is starting to look more like a house of cards and less like modern infrastructure.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="line-height: 20px;"&gt;In the immortal words of Puppet founder Luke Kanies:&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
&lt;span class="Apple-style-span" style="line-height: 20px;"&gt;&lt;b&gt;"SSH in a for loop just doesn't cut it anymore."&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
&lt;span class="Apple-style-span" style="line-height: 20px;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span class="Apple-style-span" style="line-height: 20px;"&gt;To build Luke's statement, our imperative bash/perl/python scripts are lousy for customizing server templates to specific node attributes and they suck at maintaining system state.&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="line-height: 20px;"&gt;I&lt;/span&gt;&amp;nbsp;have tried both Puppet and &amp;nbsp;Chef and I prefer Chef for a number of reasons. The main ones are that it has a more elegant and easier to use &lt;a href="http://blog.loftninjas.org/2011/02/16/the-power-of-chef-and-ruby/"&gt;DSL&lt;/a&gt; and that chef-server has the awesome &lt;a href="http://wiki.opscode.com/display/chef/Search"&gt;search functionality&lt;/a&gt;.&lt;br /&gt;
&lt;span class="Apple-style-span" style="line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Installation&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Install my chef repository somewhere on your system. I recommend /opt.&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
$&amp;nbsp;&lt;/code&gt;&lt;code&gt;git clone git://github.com/bryanwb/dirty-chef.git&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Next install chef. &amp;nbsp;Here is the &lt;a href="http://wiki.opscode.com/display/chef/Bootstrap+Chef+RubyGems+Installation"&gt;main install guide&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This should work on either CENTOS/RHEL 5 or 6&lt;br /&gt;
&lt;br /&gt;
For RHEL 5&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: monospace; font-size: 16px;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre style="font-size: 14px;"&gt;$ rpm -Uvh http://rbel.co/rbel5&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
For RHEL 6&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: monospace; font-size: 16px;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre style="font-size: 14px;"&gt;rpm -Uvh http://rbel.co/rbel6&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, on either&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;
$ yum install -y rubygem-chef ruby-shadow&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;
Now edit solo.rb, you &lt;b&gt;have to edit&lt;/b&gt; these paths to reflect the actual location of dirty-chef otherwise chef-solo will not work&lt;br /&gt;
&lt;br /&gt;
file:solo.rb&lt;br /&gt;
&lt;code&gt;
file_cache_path  "/opt/dirty-chef/"&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;cookbook_path  "/opt/dirty-chef/cookbooks"&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;data_bag_path  "/opt/dirty-chef/databags"
&lt;/code&gt;

&lt;br /&gt;
&lt;br /&gt;
If you are using RHEL 5 see the install link above, it has steps for RHEL 5 but they are more complicated

Run the following command&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;$ ohai | less&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
This shows you all the info that chef knows about your system. You can do reasoning in your recipes based on these values.&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Start Cooking&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Here is a stupid hello world&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;$ cd dirty-chef&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;$ chef-solo -c solo.rb -j node.json&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;ohai!&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
What the heck did we just do? The solo.rb tells chef where the cookbooks are, i.e. where the recipes live, and node.json tells chef-solo which recipe to actually apply.&lt;br /&gt;
&lt;br /&gt;
file:node.json&lt;br /&gt;
&lt;code&gt;
{&lt;br /&gt;
&amp;nbsp; "run_list": [ "recipe[dirty]" ]&lt;br /&gt;
}&lt;br /&gt;
&lt;/code&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This loads the recipe in cookbooks/dirty/default.rb&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
If you get any errors here, you should make sure that you changed the paths in solo.rb to reflect the location of dirty-chef/&lt;br /&gt;
&lt;br /&gt;
Now let us do something more significant.

You can use chef to declare "resources" in this case a package. Let's install subversion. In chef recipes, you spend most of your time declaring &lt;a href="http://wiki.opscode.com/display/chef/Resources"&gt;resources&lt;/a&gt;, in this case I declare that I want subversion installed and chef takes care of the rest.&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;file:cookbooks/dirty/recipes/example1.rb&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;package "subversion"&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;$ chef-solo -c solo.rb -j example1.json&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
file:example1.json&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;{&lt;br /&gt;&amp;nbsp; "run_list": [ "recipe[dirty::example1]" ]&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This loads the recipe in cookbooks/dirty/example1.rb&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example of installing multiple packages, take a look at cookbooks/dirty/recipes/example2.rb&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;$ chef-solo -c solo.rb -j example2.json&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;/code&gt;What is that syntax of the configuration language? Why it is pure ruby. If you like perl, you will like ruby as it is the lovechild of perl and smalltalk.

Here is a &lt;a href="http://wiki.opscode.com/display/chef/Just+Enough+Ruby+for+Chef"&gt;good quick reference&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
You still are not impressed? True you could do all these things in a kickstart more easily and without having to go to so much trouble. There are several reasons chef is better than kickstart.

You can use chef to maintain the state of your server while you can only use kickstart to initially set up your server.
Once you install your server from a kickstart, you cannot rerun it w/out reformatting it. Chef on the other hand is "idempotent" Meaning it has the same effect whether run once or 100 times. Say for some reason subversion is removed from your machine. The above chef recipe will reinstall it w/out needing your intervention.

You can seamlessly handle different platform versions. You can write one recipe that handles both RHEL 5 and RHEL 6 by doing reasoning on node attributes.
Maybe you are like me and love nothing better than a good REPL (Read-Eval Print Loop), i.e. console. Chef comes with an awesome REPL, shef. Let us use it to play node attributes and even load recipes interactively&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;[root@woof-chef recipes]# shef&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;loading configuration: none (standalone shef session)&amp;nbsp;
&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;Session type: standalone&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;Ohai2u root@woof-chef!&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;chef &amp;gt; if node["platform_version"] =~ /6./&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;chef ?&amp;gt; puts "hi rhel 6!"&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;chef ?&amp;gt; end&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;hi rhel 6!&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;[ type ctl-D to exit ]&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
In shef, you have access to all the node attributes and cookbooks on your system. Now let us put the same logic in a recipe.&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;$ chef-solo -c solo.rb -j example3.json&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Now we still haven't actually done anything useful. We will get to that in Part II&lt;/span&gt;&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/Devopsanywhere/~4/m41Zj6PaZEg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://devopsanywhere.blogspot.com/feeds/2643145307113580497/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://devopsanywhere.blogspot.com/2011/10/stupid-simple-chef-tutorial-for-dirty.html#comment-form" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/2643145307113580497?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/2643145307113580497?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Devopsanywhere/~3/m41Zj6PaZEg/stupid-simple-chef-tutorial-for-dirty.html" title="A Stupid, Simple Chef Tutorial for Dirty, Lazy Fry Cooks (Like Me) Part I" /><author><name>Bryan Berry</name><uri>https://plus.google.com/106664679333642993534</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-TyULMG7ZA6A/AAAAAAAAAAI/AAAAAAAAAAA/wjGutwhuhAU/s512-c/photo.jpg" /></author><thr:total>5</thr:total><feedburner:origLink>http://devopsanywhere.blogspot.com/2011/10/stupid-simple-chef-tutorial-for-dirty.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU8AR3ozeCp7ImA9WhdUFkk.&quot;"><id>tag:blogger.com,1999:blog-1083699665345453745.post-1349270735738108110</id><published>2011-10-03T01:47:00.000-07:00</published><updated>2011-10-03T06:17:26.480-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-03T06:17:26.480-07:00</app:edited><title>What is devopsanywhere?</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Why DevopsAnywhere? Because our profession is undergoing some profound changes. On the positive side, the best of us are in &lt;a href="http://www.businessweek.com/magazine/puppet-chef-ease-transition-to-cloud-computing-09012011.html"&gt;increasing demand&lt;/a&gt;. On the other hand, it will take increasing sophistication on our parts to keep up w/ the blistering pace of change in our industry. I believe that to really keep up-to-date, you have be an &lt;a href="http://en.wikipedia.org/wiki/Autodidacticism"&gt;autodidact&lt;/a&gt;, that is someone who is primarily self-taught.&lt;br /&gt;
&lt;br /&gt;
In my experience, autodidacts are randomly distributed around the planet. Linux obsessing, python hacking, ruby scripting geeks are even more randomly distributed. Should companies really want to recruit us, they will have to hire us where we are, be that Kathmandu, Sicily, or Utah. Gone are the days where system administrators lived at the datacenter, as I explain in greater detail later.&lt;br /&gt;
&lt;br /&gt;
As system administrators we were tied to the datacenter. Even if we worked remotely, we had to be within easy driving distance. We were software/hardware hybrids that understood all the various permutations of RAID 0/1/5/6/10. We looked on with envy at the alpha programmers who could do their jobs while lying on the beach in Thailand or while huddled in a cozy cabin in the French Alps.&lt;br /&gt;
&lt;br /&gt;
Our profession is transforming from System Administrators to Devops Engineers. &lt;i&gt;Devop&lt;/i&gt;s is a bit tricky as it is as vague a term as &lt;i&gt;agile&lt;/i&gt;. Still, it points to a new class of engineers that are focused on &lt;b&gt;op&lt;/b&gt;eration&lt;b&gt;s&lt;/b&gt; and work seamlessly with software &lt;b&gt;dev&lt;/b&gt;elopers. We are self-taught engineers who have the luxury to work remotely. This blog will be entirely focused on the concerns and interests of devops engineers working remotely. Further, I won't talk about expensive proprietary software or hardware. Actually, I will rarely talk about hardware at all.&lt;br /&gt;
&lt;br /&gt;
Some, like &lt;a href="http://www.johnmwillis.com/"&gt;John Willis&lt;/a&gt; and &lt;a href="http://twitter.com/#!/damonedwards"&gt;Damon Edwards&lt;/a&gt;&amp;nbsp;of the awesome &lt;a href="http://devopscafe.org/"&gt;Devops Cafe&lt;/a&gt;, will argue that process is more important tooling. I agree with this 100%. However, as system administrators we often aren't in the position to reorganize our team's management structure. We are in a position to introduce new tools and lobby for better ways of working.&lt;br /&gt;
&lt;br /&gt;
Here is a comparison of the requirements for being a SysAdmin and that for Devops Engineer&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;A new Set of Skills&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
System Administration today requires:&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;deep knowledge of *nix, including linux, solaris, and even some proprietary unices like HP-UX&lt;/li&gt;
&lt;li&gt;you really __know__ bash&lt;/li&gt;
&lt;li&gt;some basic version control&amp;nbsp;w/ cvs/svn&lt;/li&gt;
&lt;li&gt;simple scripting w/ bash/perl/python&lt;/li&gt;
&lt;li&gt;understanding of virtualization&lt;/li&gt;
&lt;li&gt;You can troubleshoot hardware, firmware issues, even flip a dip switch or change SCSI IDs if necessary&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Devops requires:&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;deep knowledge of Linux -- generally not Solaris, AIX or&amp;nbsp;HP-UX&lt;/li&gt;
&lt;li&gt;you __know__ bash&lt;/li&gt;
&lt;li&gt;you are very proficient in svn and/or git&lt;/li&gt;
&lt;li&gt;You are a practicioner of puppet or chef&lt;/li&gt;
&lt;li&gt;system scripting with ruby&lt;/li&gt;
&lt;li&gt;System packaging -- ruby gems, rpms, debian packages&lt;/li&gt;
&lt;li&gt;You can setup package repositiories on a whim&lt;/li&gt;
&lt;li&gt;you understand unit testing and behavior-driven testing, hopefully you practice it w/ &lt;a href="http://cukes.info/"&gt;Cucumber&lt;/a&gt;&amp;nbsp;or something like it&lt;/li&gt;
&lt;li&gt;AWS, Rackspace, cloud provisioning -- &amp;nbsp;but of course&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Hardware is now (mostly) irrelevant&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The only NIC cards a devops engineer cares about are the Intel e1000 or whatever paravirtualized driver your hypervisor of choice offers.&amp;nbsp;We know that working on hardware issues only lowers our hourly billing rate. Now, more than ever, the power is in software and hardware-oriented solutions are to be avoided.&lt;br /&gt;
&lt;br /&gt;
I must confess that I have an ulterior motive for starting this blog. I am a linux system administrator who is following his wife's career around the world. Previously we were in Nepal, now we are in Italy, next up who knows! But I want to work with top-notch teams wherever I end up and not be tied to whatever opportunities are locally available. If you are a devops guy and you feel the same, let me know!&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/Devopsanywhere/~4/rWwMXbrn6ng" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://devopsanywhere.blogspot.com/feeds/1349270735738108110/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://devopsanywhere.blogspot.com/2011/10/what-is-devopsanywhere.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/1349270735738108110?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/1349270735738108110?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Devopsanywhere/~3/rWwMXbrn6ng/what-is-devopsanywhere.html" title="What is devopsanywhere?" /><author><name>Bryan Berry</name><uri>https://plus.google.com/106664679333642993534</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-TyULMG7ZA6A/AAAAAAAAAAI/AAAAAAAAAAA/wjGutwhuhAU/s512-c/photo.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://devopsanywhere.blogspot.com/2011/10/what-is-devopsanywhere.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkMFSXY7cSp7ImA9WhdUFkg.&quot;"><id>tag:blogger.com,1999:blog-1083699665345453745.post-3289398787867988793</id><published>2011-09-16T11:12:00.000-07:00</published><updated>2011-10-03T07:00:18.809-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-03T07:00:18.809-07:00</app:edited><title>How Ruby is beating Python in the battle for the Soul of System Administration</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div&gt;
Roughly three years ago I purchased the book &lt;a href="http://www.amazon.com/Python-Unix-Linux-System-Administration/dp/0596515820/ref=sr_1_3?ie=UTF8&amp;amp;qid=1316171701&amp;amp;sr=8-3"&gt;"Python for Unix and Linux System Administration"&lt;/a&gt; and it convinced me that Python would be the default scripting language for linux system administrators for the foreseeable future. I was working on the One Laptop Per Child project at the time, where Python was the lingua franca. It seemed that Red Hat was using Python for almost every new project. Further, &lt;a href="http://en.wikipedia.org/wiki/Unladen_Swallow"&gt;Unladen Swallow&lt;/a&gt; was making rapid progress. I couldn't have been more wrong.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Through a combination of historical accident and some seemingly minor feature differences, ruby is inexorably becoming the dominant scripting language for linux system administration. &lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Before I go any farther you die-hard sysadmins are probably screaming "We already have a scripting language, Bash!" While we love bash and &lt;a href="http://www.commandlinefu.com/commands/browse"&gt;commandlinefu&lt;/a&gt;, Bash becomes a liability not an asset once your script exceeds 100 lines and a total nightmare if you need to parse or output HTML, CSV, XML, JSON, etc.  &lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Historical Accidents&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
In 2004, Luke Kanies set about building &lt;a href="http://www.puppetlabs.com/"&gt;Puppet&lt;/a&gt;,  a configuration management system to improve upon the deficiencies he saw in CFEngine. From the excellent &lt;a href="http://on-ruby.blogspot.com/2008/02/puppet-interview-with-luke-kanies.html"&gt;On Ruby blog&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="background-color: white; color: #333333; line-height: 16px;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;blockquote&gt;
&lt;span class="Apple-style-span" style="background-color: white; color: #333333; line-height: 16px;"&gt;&lt;span class="Apple-style-span"&gt;I tried to implement my idea in perl, but I just couldn’t get the class relationships to work (the attributes and resource types each needed to be classes, according to the design in my head). This was back when Python was the shiznit, so I naturally tried it, but Python just makes my eyes bleed (and no, it wasn’t the whitespace, it was things like the fact that ‘print’ was a statement instead of a function, and ‘len’ was a function instead of a method).&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;span class="Apple-style-span" style="background-color: white; color: #333333; line-height: 16px;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;blockquote&gt;
&lt;span class="Apple-style-span" style="background-color: white; color: #333333; line-height: 16px;"&gt;&lt;span class="Apple-style-span"&gt;I had a friend who had heard Ruby was cool but hadn’t actually tried it himself. Since I was just messing around at the time, I figured I’d give it a go. Four hours in, never having seen a line of Ruby previously, I had a functional prototype.&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;span class="Apple-style-span" style="background-color: white; color: #333333; line-height: 16px;"&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
A couple years, a number of Puppet developers felt that Puppet didn't meet their needs. They started their own configuration management tool, &lt;a href="http://wiki.opscode.com/display/chef/Home"&gt;Chef&lt;/a&gt;, heavily inspired by Puppet. The biggest outward difference between Puppet and Chef is that Chef uses pure ruby as its "recipes" whereas Puppet uses its own configuration language based on ruby. &lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Both Puppet and Chef are seeing rapid adoption by big companies &lt;a href="http://www.businessweek.com/magazine/puppet-chef-ease-transition-to-cloud-computing-09012011.html"&gt;according to BusinessWeek&lt;/a&gt;. If you aren't yet using Puppet or Chef, you should be planning on it in the near future. Whether you choose Chef or Puppet, you are effectively scripting your infrastructure with ruby. After spending 25% of your time working with Puppet, you will be much more likely to reach for ruby for your next scripting task.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span"&gt;&lt;b&gt;Popular Projects&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Off-hand here is a non-definitive list of sysadmin/devops related projects in ruby&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;puppet&lt;/li&gt;
&lt;li&gt;chef&lt;/li&gt;
&lt;li&gt;&lt;a href="http://vagrantup.com/"&gt;vagrant&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;mcollective&lt;/li&gt;
&lt;li&gt;&lt;a href="http://cukes.info/"&gt;cucumber&lt;/a&gt; (behavior-driven testing)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/capistrano/capistrano/wiki/Documentation-v2.x"&gt;capistrano&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;rake (ruby Make)&lt;/li&gt;
&lt;li&gt;aeolus project/openshift&lt;/li&gt;
&lt;li&gt;cloud foundry&lt;/li&gt;
&lt;li&gt;graylog2&lt;/li&gt;
&lt;li&gt;logstash&lt;/li&gt;
&lt;li&gt;travis-ci&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
and in Python:&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://openstack.org/"&gt;openstack&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://fedorahosted.org/cobbler/"&gt;cobbler&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://fabfile.org/"&gt;fabric&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://fedorahosted.org/func/"&gt;func&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;buildbot&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
What's important here isn't the length of the respective lists but the importance of the individual projects. Chef, Puppet, and Vagrant are the new hammers and screwdrivers of system administration. If you are a sysadmin and aren't yet using these tools, don't worry, you will be sooner or later.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Openstack deserves special attention as it is a very exciting but early stage project. It could play a big role in your future as a system administrator.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Please notify me of significant devops projects that are missing from this list.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span class="Apple-style-span"&gt;What a &lt;strike&gt;Girl&lt;/strike&gt; Sysadmin Wants&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here are the features in a scripting language that a sysadmin wants&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;A DSL for the problem domain &lt;/li&gt;
&lt;li&gt;High productivity, i.e. concise and expressive syntax&lt;/li&gt;
&lt;li&gt;Easy to interaction with shell commands&lt;/li&gt;
&lt;li&gt;Regular Expressions&lt;/li&gt;
&lt;li&gt;powerful one-liners&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
Notice that performance is not on this list of requirements. Ruby is significantly slower than Python and this was particularly true for the 1.8.* series of Matz Ruby Interpreter (MRI). However, performance just isn't critical for 90% of our work as sysadmins. We care about productivity more than we care about performance. Readability is nice but it is a distant second to productivity.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Python doesn't have regular expressions embedded in the language, probably to improve readability. It also limits the number of top-level built-in global variables. From a language design perspective, this is much cleaner. From the perspective of your average street-trained, stress-laden, vi-addicted sysadmin, it is annoying.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
These top-level variables also make one-liners more concise. Here are just a few&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;span class="Apple-style-span"&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;code&gt;&lt;span class="Apple-style-span"&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;code&gt;&lt;code&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;code&gt;&lt;span class="Apple-style-span"&gt;$_        last line read from STDIN&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;code&gt;&lt;code&gt;&lt;span class="Apple-style-span"&gt;$?        last exit code from a child process&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;code&gt;&lt;code&gt;&lt;span class="Apple-style-span"&gt;$stdin    reference to stdin&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;code&gt;&lt;code&gt;&lt;span class="Apple-style-span"&gt;$stderr   reference to stdout&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;code&gt;&lt;code&gt;&lt;span class="Apple-style-span"&gt;$stdout   reference to stdout&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;code&gt;&lt;code&gt;&lt;span class="Apple-style-span"&gt;&lt;/span&gt;&lt;/code&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;code&gt;&lt;span class="Apple-style-span"&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;span class="Apple-style-span"&gt;Here is an irb session to show you these values in action&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;span class="Apple-style-span"&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;code&gt;&lt;span class="Apple-style-span"&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div&gt;
&lt;code&gt;&lt;span class="Apple-style-span"&gt;hitman@hiroko:~/pr$ irb&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;&lt;span class="Apple-style-span"&gt;irb(main):001:0&amp;gt; %x[ ls -a ]&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;&lt;span class="Apple-style-span"&gt;=&amp;gt; ".\n..\nfoo1\nfoo2\nfoo3\n"&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;&lt;span class="Apple-style-span"&gt;irb(main):002:0&amp;gt; puts $?&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;&lt;span class="Apple-style-span"&gt;0&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;&lt;span class="Apple-style-span"&gt;=&amp;gt; nil&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;&lt;span class="Apple-style-span"&gt;irb(main):003:0&amp;gt; %x[ ls xys ]&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;&lt;span class="Apple-style-span"&gt;ls: cannot access xys: No such file or directory&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;&lt;span class="Apple-style-span"&gt;=&amp;gt; ""&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;&lt;span class="Apple-style-span"&gt;irb(main):004:0&amp;gt; puts $?&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;&lt;span class="Apple-style-span"&gt;512&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;&lt;span class="Apple-style-span"&gt;=&amp;gt; nil&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;span class="Apple-style-span"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span class="Apple-style-span"&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span class="Apple-style-span"&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;span class="Apple-style-span"&gt;"IRB?" you scoff "You will have to tear IPython from my cold dead hands." &lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;span class="Apple-style-span"&gt;I love IPython. I have used IPython for 4+ years and IRB doesn't hold a candle to it. That said, ruby's shortcuts are really useful, enough to compensate for IRB's shortcomings. There is something called &lt;a href="http://pablotron.org/software/wirble/"&gt;wirble&lt;/a&gt; that I haven't tried yet that may make irb a lot more&amp;nbsp;&lt;/span&gt;productive.&lt;/div&gt;
&lt;div style="text-align: -webkit-auto;"&gt;
&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span"&gt;Here some python code to detect whether a machine is a VMware VM.&lt;/span&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: monospace;"&gt;&lt;span class="Apple-style-span" style="background-color: #f6f6ef; font-family: Verdana; font-size: 12px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre style="max-width: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 2px; padding-left: 2px; padding-right: 2px; padding-top: 2px;"&gt;&lt;span class="Apple-style-span" style="font-family: monospace;"&gt;&lt;code&gt;# edit: fixed python code tks to kstrauser&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="max-width: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 2px; padding-left: 2px; padding-right: 2px; padding-top: 2px;"&gt;&lt;span class="Apple-style-span" style="font-family: monospace;"&gt;&lt;code&gt;  import os
    if 'vmware' in os.popen('dmidecode').upper():
        print 'this is a vmware vm'
    else:
        print 'this is not a vmware vm'&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="max-width: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 2px; padding-left: 2px; padding-right: 2px; padding-top: 2px;"&gt;&lt;span class="Apple-style-span" style="font-family: monospace;"&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="max-width: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 2px; padding-left: 2px; padding-right: 2px; padding-top: 2px;"&gt;&lt;span class="Apple-style-span" style="font-family: monospace;"&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
Here the same code in ruby&lt;br /&gt;
&lt;br /&gt;
`dmidecode`&lt;br /&gt;
if $_ ~= /vmware/i&lt;br /&gt;
&amp;nbsp; &amp;nbsp; puts 'this is a vmware vm'&lt;br /&gt;
else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; puts 'this is not a vmware vm'

&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Frankly, this kind of code makes my eyes bleed. The python example is far more readable and maintainable. That said, a lot of sysadmins would appreciate the terseness of the ruby example.&lt;br /&gt;
&lt;br /&gt;
Let's look at writing one-liners in both languages.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This code prints out the first 10 lines in a file using Python&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;code&gt;python -c "import sys; sys.stdout.write(''.join(sys.stdin.readlines()[:10]))" &amp;lt; /path/to/your/file&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
here is the same in Ruby&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;ruby -ne 'puts $_ if $. &amp;lt;= 10 ' &amp;lt; /path/to/your/file &lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Compare for yourself between these collections of oneliners in &lt;a href="http://wiki.python.org/moin/Powerful%20Python%20One-Liners"&gt;python&lt;/a&gt; and &lt;a href="http://reference.jumpingmonkey.org/programming_languages/ruby/ruby-one-liners.html"&gt;ruby&lt;/a&gt;. If ruby reminds of perl, your eyes do not deceive you. In many ways it is the love child of perl and smalltalk.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span class="Apple-style-span"&gt;DSLs FTW&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Some time ago, I tried to watch all the &lt;a href="http://mitpress.mit.edu/sicp/"&gt;Structure and Interpretation of Computing&lt;/a&gt; lectures. This endeavor failed miserably but I recall Harold Abelson saying that every large program should have its own internal DSL suited to the problem space. This is debatable in regards to the larger world of programming but I think it is very apt for system administration. We spend our entire careers with &lt;i&gt;n&lt;/i&gt; different DSLs. Each different configuration file format is its own DSL.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If you compare rake (Ruby Make) to rails code, they look quite different, almost like different languages. If you compare &lt;a href="http://fabfile.org/"&gt;fabric&lt;/a&gt; code to a django class, they look quite similar. This is both a strength and a liability. I am not a language lawyer but it seems much easier to create DSL's (Domain Specific Languages). Ruby certainly spawns DSLs with much greater frequency than python. No single pythonic build tool dominates the problem space like rake does in the ruby community. Most python projects seems to use &lt;a href="http://docs.python.org/distutils/setupscript.html"&gt;setup.py&lt;/a&gt; for administrative tasks even though that is not its explicit purpose.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Both puppet and chef are DSLs for system administration. Capistrano is a DSL for application deployment. Ruby's operator overriding and blocks lend themselves to the easy creation of DSLs.&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span class="Apple-style-span"&gt;In Summary&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Ruby's greatest strength is its amazing flexibility. There is a lot of "magic" in ruby and sometimes it is dark magic. Python intentionally has minimal magic. It's greatest strengths are the best practices it enforces across its community. These practices make Python very readable across different projects; they ensure high quality documentation; they make the standard library kick ass. But the fact is that we sysadmins need flexibility more than we need raw power or consistency. Still, these are not the real reasons that ruby is overtaking python.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Ruby is fast becoming the default scripting language for sysadmins because back in 2004, Luke Kanies looked at Python and &lt;a href="http://on-ruby.blogspot.com/2008/02/puppet-interview-with-luke-kanies.html"&gt;felt ill&lt;/a&gt; (I had the opposite reaction). As a sysadmin you either currently are or soon will be using Puppet or Chef on a daily basis, spending a heck of a lot of time essentially coding in ruby. Personally, I much prefer writing python but am shifting to writing my scripts in ruby because I spend so much time with Chef.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;img src="http://feeds.feedburner.com/~r/Devopsanywhere/~4/NGiXR2WzvDs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://devopsanywhere.blogspot.com/feeds/3289398787867988793/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://devopsanywhere.blogspot.com/2011/09/how-ruby-is-beating-python-in-battle.html#comment-form" title="37 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/3289398787867988793?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1083699665345453745/posts/default/3289398787867988793?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Devopsanywhere/~3/NGiXR2WzvDs/how-ruby-is-beating-python-in-battle.html" title="How Ruby is beating Python in the battle for the Soul of System Administration" /><author><name>Bryan Berry</name><uri>https://plus.google.com/106664679333642993534</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh3.googleusercontent.com/-TyULMG7ZA6A/AAAAAAAAAAI/AAAAAAAAAAA/wjGutwhuhAU/s512-c/photo.jpg" /></author><thr:total>37</thr:total><feedburner:origLink>http://devopsanywhere.blogspot.com/2011/09/how-ruby-is-beating-python-in-battle.html</feedburner:origLink></entry></feed>
