Chef and Rickshaw

Chef Overview

Code as Infrastructure

  • Treat like any other code base [1]
  • Reconstruct business logic from code
  • Programmatically provision and configure
  • Ensure Nodes are in comply with policies
  • Managing complexity via Recipes, Resources and Nodes

Chef Server

  • Store cookbooks, recipes and data bags

Chef Client

  • Software that run on the Node
  • Mutating the Node to a declared state


  • Manage Clients remotely
  • Uses Chef Server's API


  • Collection of recipes, attributes and resources
Berksfile   Gemfile     Rakefile    chefignore  recipes     test   attributes  metadata.rb templates

name             "catheral"
maintainer       "Bao Nguyen"
maintainer_email ""
license          "All rights reserved"
description      "Where bishop goes"
long_description, ''))
version "0.0.1"

depends   "partial_search"
depends   "arista-eapi"
depends   "credentials"
depends   "fst-base"


directory "/home/hello" do
    owner "hello"
    group "hello"
    mode 0755
    action :create
  • Represent a piece of a system in a desire state
  • Idempotent

Attribute (node)

  • State of a Node
default['rickshaw']['netops'] = [

Rickshaw Workflow

$ knife node show oob-iad2107

Node Name:   oob-iad2107
Environment: production
FQDN:        oob-iad2107
Run List:    recipe[datacenter::iad], role[fantomtest], role[oob], recipe[rickshaw::iad]
Recipes:     rickshaw::iad
Platform:    ubuntu 12.04
Tags:        fantomtest, public, rickshaw
$ knife data bag show datacenter iad

  city:    Ashburn
  cluster: IAD
  name:    IAD
  region:  US-East
  gmond_port: 8956
id:            iad
    p3p1: 172.16.130.
    p3p2: 172.16.134.
    p5p1: 172.16.128.
    p5p2: 172.16.132.
ospf_disabled: true
  network: production
  healthcheck_disable: false
  novcl:               1
$ kitchen converge

-----> Converging <default-ubuntu>...
       Preparing files for transfer
       Resolving cookbook dependencies with Berkshelf 3.2.2...
       Removing non-cookbook files before transfer
       Preparing data bags
       Transfering files to <default-ubuntu>
       [2015-03-03T17:46:13+00:00] INFO: Started chef-zero at http://localhost:8889 with repository at /tmp/kitchen, /tmp/kitchen
         One version per cookbook

       [2015-03-03T17:46:13+00:00] INFO: Forking chef instance to converge...
       Starting Chef Client, version 12.0.3
       [2015-03-03T17:46:14+00:00] INFO: *** Chef 12.0.3 ***
       [2015-03-03T17:46:14+00:00] INFO: Chef-client pid: 28
       Creating a new client identity for default-ubuntu using the validator key.
       [2015-03-03T17:46:15+00:00] INFO: Client key /tmp/kitchen/client.pem is not present - registering
       [2015-03-03T17:46:15+00:00] WARN: Child with name 'dna.json' found in multiple directories: /tmp/kitchen/dna.json and /tmp/kitchen/dna.json
       [2015-03-03T17:46:15+00:00] WARN: Child with name 'dna.json' found in multiple directories: /tmp/kitchen/dna.json and /tmp/kitchen/dna.json
       [2015-03-03T17:46:15+00:00] INFO: HTTP Request Returned 404 Not Found : Object not found: http://localhost:8889/nodes/default-ubuntu
       [2015-03-03T17:46:15+00:00] INFO: Setting the run_list to ["recipe[rickshaw::local]"] from CLI options
       [2015-03-03T17:46:15+00:00] INFO: Run List is [recipe[rickshaw::local]]
       [2015-03-03T17:46:15+00:00] INFO: Run List expands to [rickshaw::local]
       [2015-03-03T17:46:15+00:00] INFO: Starting Chef Run for default-ubuntu
       [2015-03-03T17:46:15+00:00] INFO: Running start handlers

knife cookbook upload rickshaw

knife ssh "tag:rickshaw" "sudo chef-client -o rickshaw::_user"

or limited list

knife ssh "name:oob-iad2107" "sudo chef-client -o rickshaw::_user" 

Chef and Rickshaw

By Bao Nguyen

Chef and Rickshaw

  • 1,432