<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>http://erik.hollensbe.org/</id>
  <title>Erik Hollensbe</title>
  <updated>2011-06-20T02:16:51Z</updated>
  <link rel="alternate" href="http://erik.hollensbe.org/"/>
  <link rel="self" href="http://erik.hollensbe.org/feed.xml"/>
  <author>
    <name>Erik Hollensbe</name>
    <uri>http://erik.hollensbe.org</uri>
  </author>
  <entry>
    <id>tag:erik.hollensbe.org,2011-06-19:/entries/anatomy_of_a_chef_cookbook_part_1/</id>
    <title type="html">The Anatomy of a Chef Cookbook, Part 1 - Introduction</title>
    <published>2011-06-20T02:16:51Z</published>
    <updated>2011-06-20T02:16:51Z</updated>
    <link rel="alternate" href="http://erik.hollensbe.org/entries/anatomy_of_a_chef_cookbook_part_1/"/>
    <content type="html">&lt;h3&gt;Foreword&lt;/h3&gt;

&lt;p&gt;
  Chef cookbooks can get pretty complicated between all the directories,
  nomenclature, and of course the meat: the code itself. This
  series will hopefully demystify some of that by walking through the creation
  of two cookbooks that depend on each other: one to manage the popular
  &lt;a href="http://www.virtualbox.org"&gt;VirtualBox&lt;/a&gt; virtualization software,
  and another to launch virtual machines with the popular ruby-based virtualbox
  frontend &lt;a href="http://www.vagrantup.com"&gt;Vagrant&lt;/a&gt;. 
&lt;/p&gt;

&lt;p&gt;
  I'm not a very formal guy so I'm not really feeling the notion of determining
  how many parts there are to this beforehand. Simply put, if there's more to
  write that I haven't covered in a previous blog entry, I will create a new
  one. To look at it another way, this is partially a diary of the development
  of these two cookbooks.
&lt;/p&gt;

&lt;p&gt;
  If you're new to Chef or Chef cookbook writing, don't forget the 
  &lt;a href="http://wiki.opscode.com/display/chef/Cookbooks"&gt;OpsCode Wiki on Cookbooks&lt;/a&gt;. 
  Even though I'm blogging again, I'm a firm protestor of
  blogs-as-documentation and I think you should be too. This series is
  intended to document one specific case for educational and reflective
  purposes, not teach you all there is to know about cookbooks.
&lt;/p&gt;

&lt;p&gt;
  Let's start with the basics of Chef 0.10.0, then. Part 2 will be a little
  more meat for those of you who already know this stuff.
&lt;/p&gt;

&lt;h3&gt;Chef Anatomy&lt;/h3&gt;

&lt;p&gt;
  &lt;a href="http://wiki.opscode.com/display/chef/Home"&gt;Chef&lt;/a&gt; 
  is a configuration management platform both written in, and driven by ruby.
  It organizes it's operating parameters into two parts: data structures of
  various types which summarize a node's (a machine) configuration, and
  executable code in the form of a "cookbook". Configuration can be either
  in ruby or JSON, and cookbook components are -- with rare exception
  -- completely in ruby.
&lt;/p&gt;

&lt;p&gt;
  Chef the configuration management stack has 3 parts (unless you use Chef
  Solo, which is standalone and in many ways performs the functions of all 3
  parts). Namely, &lt;code&gt;chef-server&lt;/code&gt; which is the repository for
  cookbooks and configuration, &lt;code&gt;knife&lt;/code&gt; which is used to talk to
  &lt;code&gt;chef-server&lt;/code&gt;, performing various create, retrieve, update, and
  delete (CRUD) operations on the &lt;code&gt;chef-server&lt;/code&gt; repository.
  &lt;code&gt;chef-client&lt;/code&gt; is used to play the combination of cookbook and
  configuration on the desired node.
&lt;/p&gt;

&lt;h3&gt;Cookbook Filesystem Anatomy&lt;/h3&gt;

&lt;p&gt;
  &lt;code&gt;knife cookbook create&lt;/code&gt; can be used to create a new cookbook, but
  it's just as critical to understand what all those directories are for.
  Cookbooks are partitioned per-directory with section-specific code for each
  directory (role for the cookbook; not chef roles). For now we'll just
  introduce a few sections and discuss them at length.
&lt;/p&gt;

&lt;p&gt;
  A cookbook directory looks something like this:
&lt;/p&gt;

&lt;div class="CodeRay"&gt;
&lt;pre&gt;&lt;code&gt;
erikh@highland cookbooks/vagrant% ls -l
total 0
drwxr-xr-x  2 erikh  staff  102 Jun 19 03:50 attributes/
drwxr-xr-x  2 erikh  staff  136 Jun 19 03:45 recipes/
drwxr-xr-x  2 erikh  staff   68 Jun 19 03:36 templates/
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
  It will frequently have more or less directories than this, the names being
  the critical component.
  &lt;a href="http://wiki.opscode.com/display/chef/Cookbooks#Cookbooks-What%27sinaCookbook%3F"&gt;Here are what the directory names mean.&lt;/a&gt;
  Note that most of the directory entries listed at the URL are not used here;
  save the &lt;code&gt;recipes&lt;/code&gt; directory, they are optional.
&lt;/p&gt;

&lt;p&gt;
  Inside our directories, there are a few conventions. For &lt;code&gt;files&lt;/code&gt;,
  &lt;code&gt;attributes&lt;/code&gt;, and &lt;code&gt;templates&lt;/code&gt;, there are subdirectories
  or specially-named files which scope the various kinds of these items. This
  is described &lt;a href="http://wiki.opscode.com/display/chef/File+Distribution"&gt;pretty well on the opscode Wiki.&lt;/a&gt;
&lt;/p&gt; 

&lt;p&gt;
  We will go into additional detail in part 2 of this series, which will go
  into the creation of a basic recipe to install VirtualBox.. TTFN!
&lt;/p&gt;</content>
  </entry>
  <entry>
    <id>tag:erik.hollensbe.org,2011-06-18:/entries/reboot/</id>
    <title type="html">Blog Reboot</title>
    <published>2011-06-18T10:47:23Z</published>
    <updated>2011-06-18T10:47:23Z</updated>
    <link rel="alternate" href="http://erik.hollensbe.org/entries/reboot/"/>
    <content type="html">&lt;p&gt;
So, I've decided to reboot my blog. I will be adding more blog-like features
here very soon, with a focus (as usual) on nerdy topics mostly centered around
ruby and web / ops development.

More will be coming in the next few hours; just putting this up to make sure it
all still works. :)
&lt;/p&gt;</content>
  </entry>
</feed>



