SlideShare a Scribd company logo
1 of 124
Download to read offline
Introduzione a Chef

                      Giacomo Bagnoli




            Develer Workshops - 12 Settembre 2012




@gbagnoli                Introduzione a Chef        12/09/2012   1 / 50
# whoami




ā€¢ System Administrator
ā€¢ Operations Engineer
ā€¢ Python guy (having an aļ¬€air with Ruby)




     @gbagnoli             Introduzione a Chef   12/09/2012   2 / 50
Outline




1. Introduction
2. Chef Overview
3. Example




      @gbagnoli    Introduzione a Chef   12/09/2012   3 / 50
Introduction




@gbagnoli      Introduzione a Chef   12/09/2012   4 / 50
Infrastructure as code



Building and managing infrastructure programmatically




  @gbagnoli             Introduzione a Chef         12/09/2012   5 / 50
Infrastructure as code



    Building and managing infrastructure programmatically

Enable the reconstruction of the business from:




       @gbagnoli               Introduzione a Chef      12/09/2012   5 / 50
Infrastructure as code



    Building and managing infrastructure programmatically

Enable the reconstruction of the business from:
  ā€¢ computing resources




       @gbagnoli               Introduzione a Chef      12/09/2012   5 / 50
Infrastructure as code



    Building and managing infrastructure programmatically

Enable the reconstruction of the business from:
  ā€¢ computing resources
  ā€¢ a source code repository




       @gbagnoli               Introduzione a Chef      12/09/2012   5 / 50
Infrastructure as code



    Building and managing infrastructure programmatically

Enable the reconstruction of the business from:
  ā€¢ computing resources
  ā€¢ a source code repository
  ā€¢ data backups




       @gbagnoli               Introduzione a Chef      12/09/2012   5 / 50
Infrastructure as code (2)




source: Chef wiki

Provisioning Get new computing resources
Conļ¬guration Management Keeps track of all steps required to take bare
             metal resources to doing their job
System Integration Takes all conļ¬gured systems and make them work
             together.
             @gbagnoli           Introduzione a Chef       12/09/2012   6 / 50
What is Chef




@gbagnoli    Introduzione a Chef   12/09/2012   7 / 50
What is Chef




ā€¢ A library/framework for conļ¬guration management




     @gbagnoli            Introduzione a Chef       12/09/2012   7 / 50
What is Chef




ā€¢ A library/framework for conļ¬guration management
ā€¢ A conļ¬guration management system




     @gbagnoli            Introduzione a Chef       12/09/2012   7 / 50
What is Chef




ā€¢ A library/framework for conļ¬guration management
ā€¢ A conļ¬guration management system
ā€¢ A system integration platform




     @gbagnoli              Introduzione a Chef     12/09/2012   7 / 50
What is Chef




ā€¢ A library/framework for conļ¬guration management
ā€¢ A conļ¬guration management system
ā€¢ A system integration platform
ā€¢ An API for the infrastructure




     @gbagnoli              Introduzione a Chef     12/09/2012   7 / 50
What is Chef




ā€¢ A library/framework for conļ¬guration management
ā€¢ A conļ¬guration management system
ā€¢ A system integration platform
ā€¢ An API for the infrastructure
ā€¢ Open Source! (Apache License, version 2.0)




     @gbagnoli              Introduzione a Chef     12/09/2012   7 / 50
Opscode Chef




@gbagnoli      Introduzione a Chef   12/09/2012   8 / 50
Chef Principles




@gbagnoli      Introduzione a Chef   12/09/2012   9 / 50
Chef Principles


Idempotent Describes states




      @gbagnoli               Introduzione a Chef   12/09/2012   9 / 50
Chef Principles


Idempotent Describes states
 Extensible Uses ruby as the DSL




      @gbagnoli               Introduzione a Chef   12/09/2012   9 / 50
Chef Principles


Idempotent Describes states
 Extensible Uses ruby as the DSL
     Order It matters




      @gbagnoli               Introduzione a Chef   12/09/2012   9 / 50
Chef Principles


 Idempotent Describes states
  Extensible Uses ruby as the DSL
      Order It matters
Client-Server Thick Clients, thin Server




        @gbagnoli              Introduzione a Chef   12/09/2012   9 / 50
Chef Principles


 Idempotent Describes states
  Extensible Uses ruby as the DSL
      Order It matters
Client-Server Thick Clients, thin Server

Various Flavours:




        @gbagnoli              Introduzione a Chef   12/09/2012   9 / 50
Chef Principles


 Idempotent Describes states
  Extensible Uses ruby as the DSL
      Order It matters
Client-Server Thick Clients, thin Server

Various Flavours:
  ā€¢ Hosted on Opscode platform (chef-hosted)




        @gbagnoli              Introduzione a Chef   12/09/2012   9 / 50
Chef Principles


 Idempotent Describes states
  Extensible Uses ruby as the DSL
      Order It matters
Client-Server Thick Clients, thin Server

Various Flavours:
  ā€¢ Hosted on Opscode platform (chef-hosted)
  ā€¢ Open source Chef Server




        @gbagnoli              Introduzione a Chef   12/09/2012   9 / 50
Chef Principles


 Idempotent Describes states
  Extensible Uses ruby as the DSL
      Order It matters
Client-Server Thick Clients, thin Server

Various Flavours:
  ā€¢ Hosted on Opscode platform (chef-hosted)
  ā€¢ Open source Chef Server
  ā€¢ Serverless - chef-solo




        @gbagnoli              Introduzione a Chef   12/09/2012   9 / 50
Chef Principles


 Idempotent Describes states
  Extensible Uses ruby as the DSL
      Order It matters
Client-Server Thick Clients, thin Server

Various Flavours:
  ā€¢ Hosted on Opscode platform (chef-hosted)
  ā€¢ Open source Chef Server
  ā€¢ Serverless - chef-solo
  ā€¢ Private Chef (opscode-supported behind-the-ļ¬rewall installation)




        @gbagnoli              Introduzione a Chef          12/09/2012   9 / 50
Chef API



ā€¢ A RESTful service with JSON responses
ā€¢ RSA key authentication with Signed Headers
ā€¢ Search Service
ā€¢ Derivative (easy to integrate with other tools)
ā€¢ . . . i.e pychef :-)




      @gbagnoli              Introduzione a Chef    12/09/2012   10 / 50
Chef API



  ā€¢ A RESTful service with JSON responses
  ā€¢ RSA key authentication with Signed Headers
  ā€¢ Search Service
  ā€¢ Derivative (easy to integrate with other tools)
  ā€¢ . . . i.e pychef :-)


chef-client connects to the server consuming the API.
CLI management tool knife and the webUI use the API too.




        @gbagnoli              Introduzione a Chef     12/09/2012   10 / 50
Chef Architecture

                                      Solr
             CouchDB
                                                       Indexer




                                       RabbitMQ



            Chef API Server
                                                  Chef WebUI




                             Client    Client     Client


            Knife   Knife




@gbagnoli                   Introduzione a Chef                  12/09/2012   11 / 50
API Client


In chef, an API client provides the identity used to authenticate
requests to the API server.




       @gbagnoli               Introduzione a Chef          12/09/2012   12 / 50
API Client


In chef, an API client provides the identity used to authenticate
requests to the API server.

The public half of the public/private of a key pair is stored in the db on
the server, while the private part is local to the client.




        @gbagnoli               Introduzione a Chef            12/09/2012   12 / 50
API Client


In chef, an API client provides the identity used to authenticate
requests to the API server.

The public half of the public/private of a key pair is stored in the db on
the server, while the private part is local to the client.

Each request to the API contains a request signature in the HTTP
headers.
The request signature is computed by the hash of the request content and
encrypted with the client private key, so itā€™s possible to verify the identity
of the user/machine making the request.




        @gbagnoli                Introduzione a Chef            12/09/2012   12 / 50
Nodes



A Node is a host that runs the chef-client.
  ā€¢ Has attributes
  ā€¢ Has a run list
  ā€¢ Has 0+ roles
  ā€¢ Belongs to an environment

In the common case, 1 host ā‡” 1 node ā‡” 1 client




       @gbagnoli             Introduzione a Chef   12/09/2012   13 / 50
run list




"run_list": {
  "role[python_hosting]",
  "recipe[postgresql::client]",
  "recipe[chishop]"
}




    @gbagnoli          Introduzione a Chef   12/09/2012   14 / 50
Roles




ā€¢ Have attributes
ā€¢ Have a run list
ā€¢ Declared in JSON or . . .
ā€¢ Declared with the ruby DSL (automatically compiled to JSON)




     @gbagnoli                Introduzione a Chef     12/09/2012   15 / 50
Roles




  ā€¢ Have attributes
  ā€¢ Have a run list
  ā€¢ Declared in JSON or . . .
  ā€¢ Declared with the ruby DSL (automatically compiled to JSON)

If 1+ roles are in the node run list, the node run list is expanded




        @gbagnoli               Introduzione a Chef            12/09/2012   15 / 50
Roles (2)

An example role (in ruby):
name "python_hosting"
description "Python App hosting"
default_attributes(
  "nginx" => {
    "default_site_enabled" => false
  }
)
run_list(
  "recipe[python::virtualenv]",
  "recipe[uwsgi]",
  "recipe[nginx]"
)


       @gbagnoli             Introduzione a Chef   12/09/2012   16 / 50
Attributes
Store node data (i.e. ip address, hostname, fqdn, database host address,
etc.)
There are four types of attributes (in order of precedence, lowest to
highest):
  ā€¢ default
  ā€¢ normal
  ā€¢ override
  ā€¢ automatic




       @gbagnoli               Introduzione a Chef          12/09/2012   17 / 50
Attributes
Store node data (i.e. ip address, hostname, fqdn, database host address,
etc.)
There are four types of attributes (in order of precedence, lowest to
highest):
  ā€¢ default
  ā€¢ normal
  ā€¢ override
  ā€¢ automatic
Attributes can be set in:
  ā€¢ cookbooks
  ā€¢ environments
  ā€¢ roles
  ā€¢ nodes

        @gbagnoli              Introduzione a Chef          12/09/2012   17 / 50
Attributes (2)
So, in the end, as attributes are deep-merged, the following precedence
applies:




       @gbagnoli              Introduzione a Chef           12/09/2012   18 / 50
Attributes (2)
So, in the end, as attributes are deep-merged, the following precedence
applies:
  ā€¢ default attributes applied in an cookbook
  ā€¢ default attributes applied in an environment
  ā€¢ default attributes applied in a role
  ā€¢ default attributes applied on a node directly in a recipe
  ā€¢ normal attributes applied in a cookbook
  ā€¢ normal attributes applied on a node directly in a recipe
  ā€¢ override attributes applied in an cookbook
  ā€¢ override attributes applied in an environment
  ā€¢ override attributes applied in a role
  ā€¢ override attributes applied on a node directly in a recipe
  ā€¢ automatic attributes generated by Ohai

       @gbagnoli               Introduzione a Chef              12/09/2012   18 / 50
Attributes (3)


Automatic, ovverride and default are reset at the beginning of every run.
Normal attributes persist between runs.




       @gbagnoli               Introduzione a Chef           12/09/2012   19 / 50
Attributes (3)


Automatic, ovverride and default are reset at the beginning of every run.
Normal attributes persist between runs.

Attributes are searchable:

     search(:node, ā€™platform:ubuntuā€™)

or

     knife search node "platform:ubuntu"




        @gbagnoli              Introduzione a Chef           12/09/2012   19 / 50
Attributes (4)




Summary:




      @gbagnoli     Introduzione a Chef   12/09/2012   20 / 50
Attributes (4)




Summary:
 ā€¢ (sane) defaults in cookbooks




      @gbagnoli            Introduzione a Chef   12/09/2012   20 / 50
Attributes (4)




Summary:
 ā€¢ (sane) defaults in cookbooks
 ā€¢ . . . overridden in roles




       @gbagnoli                 Introduzione a Chef   12/09/2012   20 / 50
Attributes (4)




Summary:
 ā€¢ (sane) defaults in cookbooks
 ā€¢ . . . overridden in roles
 ā€¢ . . . and node-speciļ¬c data as normal attributes on the node.




       @gbagnoli                 Introduzione a Chef       12/09/2012   20 / 50
Attributes (4)




Summary:
 ā€¢ (sane) defaults in cookbooks
 ā€¢ . . . overridden in roles
 ā€¢ . . . and node-speciļ¬c data as normal attributes on the node.
 ā€¢ override and node.set can be used to force values




       @gbagnoli                 Introduzione a Chef       12/09/2012   20 / 50
Resources




Chef manages resources on a node.




       @gbagnoli            Introduzione a Chef   12/09/2012   21 / 50
Resources




Chef manages resources on a node.

Resources are speciļ¬ed in recipes, recipes stored in cookbooks.




       @gbagnoli              Introduzione a Chef          12/09/2012   21 / 50
Resources




Chef manages resources on a node.

Resources are speciļ¬ed in recipes, recipes stored in cookbooks.

The expanded run list speciļ¬es all the recipes (and thus the resources) to
manage on a given node.




        @gbagnoli              Introduzione a Chef           12/09/2012   21 / 50
Resources (2)


A resource
  ā€¢ has a type                               package "tar" do
  ā€¢ has a name                                 version "1.16.1-1"
                                               action :install
  ā€¢ has parameters
                                             end
  ā€¢ takes actions




       @gbagnoli       Introduzione a Chef               12/09/2012   22 / 50
Resources (2)


A resource
  ā€¢ has a type                                      package "tar" do
  ā€¢ has a name                                        version "1.16.1-1"
                                                      action :install
  ā€¢ has parameters
                                                    end
  ā€¢ takes actions

Actions are taken using providers, providers are chosen based on the node
platform.
(i.e. the package resource installs packages using apt on debian/ubuntu
and using yum on centos/RHEL)!




       @gbagnoli              Introduzione a Chef               12/09/2012   22 / 50
Recipes

Recipes evaluate resources in the order they appear
package "pdns-recursor" do
  action :install
end

template "#{node[:pdns][:confd]}/recursor.conf" do
  source "recursor.cfg.erb"
  owner "root"
  group "root"
  mode 0644
  notifies :restart, "service[pdns-recursor]"
end

service "pdns-recursor" do
  action [:enable, :start]
end



       @gbagnoli              Introduzione a Chef     12/09/2012   23 / 50
Recipes (2)

Recipes can include other resources, and are just ruby code
  include_recipe      "apache2"

  ...

  %w{config logs files}.each do |dir|
    directory "#{node[:myrecipe][:base_dir]}/#{dir}" do
      recursive true
      owner "myuser"
      group "mygroup"
      mode 02775
    end
  end


        @gbagnoli              Introduzione a Chef            12/09/2012   24 / 50
Cookbooks
Cookbooks are (shareable) packages for recipes.
Cookbooks for chef ā‡” gems for ruby
   cookbooks / python /
   | - - attributes
   |     ā€˜-- default . rb
   | - - files
   |     ā€˜-- default
   | - - LICENSE
   | - - metadata . rb
   | - - providers
   |     | - - pip . rb
   |     ā€˜-- virtualenv . rb
   | - - README . md
   | - - recipes
   |     | - - default . rb
   |     | - - package . rb
   |     | - - pip . rb
   |     | - - source . rb
   |     ā€˜-- virtualenv . rb
   | - - resources
   |     | - - pip . rb
   |     ā€˜-- virtualenv . rb
   ā€˜-- templates
         ā€˜-- default
               ā€˜-- p r o f i l e _ v i r t u a l e n v w r a p p e r . sh . erb




            @gbagnoli                                        Introduzione a Chef   12/09/2012   25 / 50
Cookbooks (2)



Currently 133 cookbooks available on opscode-cookbooks GitHub org.
too many to list them all!

https://github.com/opscode-cookbooks

More cookbooks on the community site at
http://community.opscode.com/cookbooks




       @gbagnoli            Introduzione a Chef         12/09/2012   26 / 50
Metadata



maintainer         "Opscode, Inc."
maintainer_email   "cookbooks@opscode.com"
license            "Apache 2.0"
description        "Installs and configures mysql for client or server"
long_description   IO.read(File.join(File.dirname(__FILE__), ā€™README.mdā€™))
version            "1.2.5"
recipe             "mysql", "Includes the client recipe to configure a client"
recipe             "mysql::client", "Installs packages required for mysql clients using run_action magic"
recipe             "mysql::server", "Installs packages required for mysql servers w/o manual intervention"
recipe             "mysql::server_ec2", "Performs EC2-specific mountpoint manipulation"

%w{ debian ubuntu centos suse fedora redhat scientific amazon }.each do |os|
  supports os
end




           @gbagnoli                          Introduzione a Chef                        12/09/2012    27 / 50
Environments
Environments can be used to manage diļ¬€erent environments (production,
test, etc) in a single Chef setup.
Roles can have diļ¬€erent run list on diļ¬€erent environments




       @gbagnoli             Introduzione a Chef         12/09/2012   28 / 50
Environments
Environments can be used to manage diļ¬€erent environments (production,
test, etc) in a single Chef setup.
Roles can have diļ¬€erent run list on diļ¬€erent environments
name "production"
description "The production environment"
cookbook_versions(
  "mysql" => "= 1.2.5",   # use version 1.2.5 only
  "apache2" => "~> 1.1"    # anything 1.1.0 < x < 1.2.0
)
# default attributes for this environment
attributes(
  "apache2" => {
    "listen_ports" => ["80", "443"]
  }
)




       @gbagnoli              Introduzione a Chef         12/09/2012   28 / 50
Environments
Environments can be used to manage diļ¬€erent environments (production,
test, etc) in a single Chef setup.
Roles can have diļ¬€erent run list on diļ¬€erent environments
name "production"
description "The production environment"
cookbook_versions(
  "mysql" => "= 1.2.5",   # use version 1.2.5 only
  "apache2" => "~> 1.1"    # anything 1.1.0 < x < 1.2.0
)
# default attributes for this environment
attributes(
  "apache2" => {
    "listen_ports" => ["80", "443"]
  }
)

As with role, the ruby DSL gets compiled to JSON when uploading to server

       @gbagnoli              Introduzione a Chef          12/09/2012   28 / 50
Environments (2)

$ knife environment list
production
$ knife environment show production -F json


{
    "name": "production",
    "description": "The production environment",
    "cookbook_versions": {
      "mysql": "= 1.2.5",
      "apache2": "~> 1.1"
    },
    "json_class": "Chef::Environment",
    "chef_type": "environment",
    "default_attributes": {
      "apache2": {
        "listen_ports": [
          "80",
          "443"
        ]
      }
    },
    "override_attributes": {
    }
}




           @gbagnoli                         Introduzione a Chef   12/09/2012   29 / 50
Environments (3)


Cookbooks can be frozen, so that following uploads with the same version
will fail.
 $ # -E automatically sets a requirement for the specified environment
 $ knife cookbook upload redis -- freeze -E production
 Uploading redis ...
 upload complete

 $ knife cookbook show redis 1.0.2 | grep " frozen "
 frozen ?: true

 $ knife cookbook upload redis
 Uploading redis ...
 ERROR : Version 1.0.2 of cookbook redis is frozen . Use -- force to override .
 ERROR : Failed to upload 1 cookbook .

 $ knife environment show production | grep redis
   users :       = 1.0.2




        @gbagnoli                     Introduzione a Chef                   12/09/2012   30 / 50
Data Bags




Data bags provide an arbitrary store of globally available JSON data.




       @gbagnoli               Introduzione a Chef          12/09/2012   31 / 50
Data Bags




Data bags provide an arbitrary store of globally available JSON data.
Data bags can be encrypted (but then cannot be searched, except for id)




       @gbagnoli               Introduzione a Chef          12/09/2012   31 / 50
Data Bags (Encrypted)


(warn: fake data ahead)

  $ knife data bag show accounts gbagnoli

  comment :               tenoh > dieliSh ā€™ i7eexeijeiSh ^ u9phaeGhuu4chaa *=
  email :                 A h r 8 i s 3 a h C h o h m 6 a e n e i c ( aef " a h1e eree Voh hie 6Up =
  group :                 Waix8Pa # iniy # oh6eem$eij =
  groups :                xa i7on g7a ihi u1n eH & ah3ier3Goh } rae7nik$einaeb =
  id :                    gbagnoli
  shadow :                yi e@ja h0v e$g 2Ae Gh } ido6koobuew | aebeenaequeRo ( xaiYei8eizi + f
                          7 ohqu < i@enequ & oh7ef - ahdae8dia [ c h a h 7 e e 4 y i e $ N 4 E e B i c h e e 5 e i r o
                          h2JaGhae ^ k 6a e ph o hj ah s h6 Ae j a ^ cheew } o ) i 0 w o 5 i e s i s h 3 d i g h i e w o h
                          tohoh0eegho7eik =
  shell :                 aeshi2ohy , ai6ai  h2Ahquu =
  ssh_keys :              [.. cut ..]
  uid :                   thahvo2IGhoh3osho8Ees /a=
  username :              poh5WiuZ2Er : it ! ee1ahf { u =




             @gbagnoli                                       Introduzione a Chef                                         12/09/2012   32 / 50
Data Bags (Decrypted)



$ knife data bag show accounts gbagnoli -- secret - file ~/. chef / enc_db_secret

comment :           Giacomo Bagnoli
email :             g . bagnoli@asidev . com
group :             wheel
groups :            [ asidev , users ]
id :                gbagnoli
organization :      asidev
shadow :            $6$ [... cut ...]
shell :             / bin / bash
ssh_keys :          [" ssh - rsa [... cut ...] Giacomo Bagnoli "]
uid :               3000
username :          g . bagnoli




        @gbagnoli                           Introduzione a Chef              12/09/2012   33 / 50
Anatomy of a Chef Run




@gbagnoli         Introduzione a Chef   12/09/2012   34 / 50
Anatomy of a Chef Run
ā€¢ chef-client starts




    @gbagnoli          Introduzione a Chef   12/09/2012   34 / 50
Anatomy of a Chef Run
ā€¢ chef-client starts
ā€¢ Builds node (runs ohai, perform deep-merge of attrs)




     @gbagnoli             Introduzione a Chef           12/09/2012   34 / 50
Anatomy of a Chef Run
ā€¢ chef-client starts
ā€¢ Builds node (runs ohai, perform deep-merge of attrs)
ā€¢ chef-client registers with the server




     @gbagnoli             Introduzione a Chef           12/09/2012   34 / 50
Anatomy of a Chef Run
ā€¢ chef-client starts
ā€¢ Builds node (runs ohai, perform deep-merge of attrs)
ā€¢ chef-client registers with the server
ā€¢ Cookbook sync




     @gbagnoli             Introduzione a Chef           12/09/2012   34 / 50
Anatomy of a Chef Run
ā€¢ chef-client starts
ā€¢ Builds node (runs ohai, perform deep-merge of attrs)
ā€¢ chef-client registers with the server
ā€¢ Cookbook sync
ā€¢ Compiles resource collection, loading:




     @gbagnoli              Introduzione a Chef          12/09/2012   34 / 50
Anatomy of a Chef Run
ā€¢ chef-client starts
ā€¢ Builds node (runs ohai, perform deep-merge of attrs)
ā€¢ chef-client registers with the server
ā€¢ Cookbook sync
ā€¢ Compiles resource collection, loading:
    ā€¢ libraries




     @gbagnoli              Introduzione a Chef          12/09/2012   34 / 50
Anatomy of a Chef Run
ā€¢ chef-client starts
ā€¢ Builds node (runs ohai, perform deep-merge of attrs)
ā€¢ chef-client registers with the server
ā€¢ Cookbook sync
ā€¢ Compiles resource collection, loading:
    ā€¢ libraries
    ā€¢ resources / deļ¬nitions




     @gbagnoli              Introduzione a Chef          12/09/2012   34 / 50
Anatomy of a Chef Run
ā€¢ chef-client starts
ā€¢ Builds node (runs ohai, perform deep-merge of attrs)
ā€¢ chef-client registers with the server
ā€¢ Cookbook sync
ā€¢ Compiles resource collection, loading:
    ā€¢ libraries
    ā€¢ resources / deļ¬nitions
    ā€¢ attributes




     @gbagnoli              Introduzione a Chef          12/09/2012   34 / 50
Anatomy of a Chef Run
ā€¢ chef-client starts
ā€¢ Builds node (runs ohai, perform deep-merge of attrs)
ā€¢ chef-client registers with the server
ā€¢ Cookbook sync
ā€¢ Compiles resource collection, loading:
    ā€¢ libraries
    ā€¢ resources / deļ¬nitions
    ā€¢ attributes
    ā€¢ recipes




     @gbagnoli              Introduzione a Chef          12/09/2012   34 / 50
Anatomy of a Chef Run
ā€¢ chef-client starts
ā€¢ Builds node (runs ohai, perform deep-merge of attrs)
ā€¢ chef-client registers with the server
ā€¢ Cookbook sync
ā€¢ Compiles resource collection, loading:
    ā€¢ libraries
    ā€¢ resources / deļ¬nitions
    ā€¢ attributes
    ā€¢ recipes
ā€¢ Executes - Conļ¬gure Node




     @gbagnoli              Introduzione a Chef          12/09/2012   34 / 50
Anatomy of a Chef Run
ā€¢ chef-client starts
ā€¢ Builds node (runs ohai, perform deep-merge of attrs)
ā€¢ chef-client registers with the server
ā€¢ Cookbook sync
ā€¢ Compiles resource collection, loading:
    ā€¢ libraries
    ā€¢ resources / deļ¬nitions
    ā€¢ attributes
    ā€¢ recipes
ā€¢ Executes - Conļ¬gure Node
    ā€¢ Converge: each resource is mapped to a provider and which takes
      action on it




     @gbagnoli               Introduzione a Chef           12/09/2012   34 / 50
Anatomy of a Chef Run
ā€¢ chef-client starts
ā€¢ Builds node (runs ohai, perform deep-merge of attrs)
ā€¢ chef-client registers with the server
ā€¢ Cookbook sync
ā€¢ Compiles resource collection, loading:
    ā€¢ libraries
    ā€¢ resources / deļ¬nitions
    ā€¢ attributes
    ā€¢ recipes
ā€¢ Executes - Conļ¬gure Node
    ā€¢ Converge: each resource is mapped to a provider and which takes
      action on it
    ā€¢ Saves Node




     @gbagnoli               Introduzione a Chef           12/09/2012   34 / 50
Anatomy of a Chef Run
  ā€¢ chef-client starts
  ā€¢ Builds node (runs ohai, perform deep-merge of attrs)
  ā€¢ chef-client registers with the server
  ā€¢ Cookbook sync
  ā€¢ Compiles resource collection, loading:
      ā€¢ libraries
      ā€¢ resources / deļ¬nitions
      ā€¢ attributes
      ā€¢ recipes
  ā€¢ Executes - Conļ¬gure Node
      ā€¢ Converge: each resource is mapped to a provider and which takes
        action on it
      ā€¢ Saves Node
      ā€¢ Runs notiļ¬cation Handlers

On errors, exception handlers are run.
        @gbagnoli              Introduzione a Chef           12/09/2012   34 / 50
Chef development workļ¬‚ow




@gbagnoli           Introduzione a Chef   12/09/2012   35 / 50
Chef development workļ¬‚ow




ā€¢ Write cookbooks/recipe




     @gbagnoli             Introduzione a Chef   12/09/2012   35 / 50
Chef development workļ¬‚ow




ā€¢ Write cookbooks/recipe
ā€¢ Upload the modiļ¬ed cookbook to the chef server




     @gbagnoli             Introduzione a Chef     12/09/2012   35 / 50
Chef development workļ¬‚ow




ā€¢ Write cookbooks/recipe
ā€¢ Upload the modiļ¬ed cookbook to the chef server
ā€¢ Add the cookbook to a run list (in a node or in a role)




     @gbagnoli               Introduzione a Chef            12/09/2012   35 / 50
Chef development workļ¬‚ow




ā€¢ Write cookbooks/recipe
ā€¢ Upload the modiļ¬ed cookbook to the chef server
ā€¢ Add the cookbook to a run list (in a node or in a role)
ā€¢ Wait for chef-client to run on nodes




     @gbagnoli               Introduzione a Chef            12/09/2012   35 / 50
Chef development workļ¬‚ow




ā€¢ Write cookbooks/recipe
ā€¢ Upload the modiļ¬ed cookbook to the chef server
ā€¢ Add the cookbook to a run list (in a node or in a role)
ā€¢ Wait for chef-client to run on nodes
ā€¢ Commit changes in git




     @gbagnoli               Introduzione a Chef            12/09/2012   35 / 50
Search
Full-text query engine based on Apache Solr.
Searches can be performed from knife and in recipes.
Almost any object is indexed by the chef server, like roles, nodes, api
clients and environments.

 $ knife search node " recipes : apache2 "
 7 items found
 ...

 $ knife search node " recipes : apache2 AND chef_environment : production "
 5 items found
 ...

 $ knife search node " roles : lxc_guest "
 9 items found
 ...

 $ knife search client " admin : true "
 4 items found
 ...

 $ knife search role " name : lxc *"
 2 items found
 ...



         @gbagnoli                        Introduzione a Chef                  12/09/2012   36 / 50
Bootstrapping


Bootstrapping is installing chef on new nodes . . . using chef.
First, create the node:
 $ knife node create mynewnode . example . com
 # .. fires up $EDITOR
 # .. set run_list / attributes / etc / environment




        @gbagnoli                   Introduzione a Chef           12/09/2012   37 / 50
Bootstrapping


Bootstrapping is installing chef on new nodes . . . using chef.
First, create the node:
 $ knife node create mynewnode . example . com
 # .. fires up $EDITOR
 # .. set run_list / attributes / etc / environment


Assuming that the new node is a bare ubuntu install, bootstrap the node
 $ knife boostrap -N mynewnode . example . com -d ubuntu $NODE_IP -- sudo -V -x ubuntu




        @gbagnoli                      Introduzione a Chef                   12/09/2012   37 / 50
Bootstrapping


Bootstrapping is installing chef on new nodes . . . using chef.
First, create the node:
  $ knife node create mynewnode . example . com
  # .. fires up $EDITOR
  # .. set run_list / attributes / etc / environment


Assuming that the new node is a bare ubuntu install, bootstrap the node
  $ knife boostrap -N mynewnode . example . com -d ubuntu $NODE_IP -- sudo -V -x ubuntu


Or, combine with provisioning (i.e. Amazon AWS)
  knife ec2 server create -I ami - db595faf -- flavor t1 . micro -- region eu - west -1 
    -G default -x ubuntu -N newnode . example . com -d ubuntu -Z eu - west -1 a


Chef Omnibus bootstrap template




            @gbagnoli                    Introduzione a Chef                    12/09/2012   37 / 50
Monitoring: CheckMK and Chef




 @gbagnoli   Introduzione a Chef   12/09/2012   38 / 50
Monitoring
We use CheckMK to conļ¬gure Icinga for monitoring our infrastructure.




       @gbagnoli              Introduzione a Chef         12/09/2012   39 / 50
Monitoring
We use CheckMK to conļ¬gure Icinga for monitoring our infrastructure.
CheckMK is a general purpose nagios plugin to retrive data from hosts.




       @gbagnoli              Introduzione a Chef           12/09/2012   39 / 50
Monitoring
We use CheckMK to conļ¬gure Icinga for monitoring our infrastructure.
CheckMK is a general purpose nagios plugin to retrive data from hosts.




 1. One active check per host per check interval (calling check mk as a
    plugin).




       @gbagnoli              Introduzione a Chef           12/09/2012   39 / 50
Monitoring
We use CheckMK to conļ¬gure Icinga for monitoring our infrastructure.
CheckMK is a general purpose nagios plugin to retrive data from hosts.




 1. One active check per host per check interval (calling check mk as a
    plugin).
 2. The connection is done via TCP to the check mk agent on the target
    host




       @gbagnoli              Introduzione a Chef           12/09/2012   39 / 50
Monitoring
We use CheckMK to conļ¬gure Icinga for monitoring our infrastructure.
CheckMK is a general purpose nagios plugin to retrive data from hosts.




 1. One active check per host per check interval (calling check mk as a
    plugin).
 2. The connection is done via TCP to the check mk agent on the target
    host (All host data is sent back at once as ASCII text.)




       @gbagnoli              Introduzione a Chef           12/09/2012   39 / 50
Monitoring
We use CheckMK to conļ¬gure Icinga for monitoring our infrastructure.
CheckMK is a general purpose nagios plugin to retrive data from hosts.




 1. One active check per host per check interval (calling check mk as a
    plugin).
 2. The connection is done via TCP to the check mk agent on the target
    host (All host data is sent back at once as ASCII text.)
 3. check mk extracts performance data.



       @gbagnoli              Introduzione a Chef           12/09/2012   39 / 50
Monitoring
We use CheckMK to conļ¬gure Icinga for monitoring our infrastructure.
CheckMK is a general purpose nagios plugin to retrive data from hosts.




 1. One active check per host per check interval (calling check mk as a
    plugin).
 2. The connection is done via TCP to the check mk agent on the target
    host (All host data is sent back at once as ASCII text.)
 3. check mk extracts performance data.
 4. check mk checks warn/crit thresholds and submits results to Icinga as
    passive checks.
       @gbagnoli              Introduzione a Chef           12/09/2012   39 / 50
Monitoring - Nodes



On nodes, the check mk::agent recipe, included in all nodes via the base
role, installs the check mk agent.




       @gbagnoli               Introduzione a Chef          12/09/2012   40 / 50
Monitoring - Nodes



On nodes, the check mk::agent recipe, included in all nodes via the base
role, installs the check mk agent.

It also sets up xinetd and the ļ¬rewall so that connections to the agent
are allowed only from the monitoring host(s).




       @gbagnoli               Introduzione a Chef          12/09/2012   40 / 50
Monitoring - Nodes



On nodes, the check mk::agent recipe, included in all nodes via the base
role, installs the check mk agent.

It also sets up xinetd and the ļ¬rewall so that connections to the agent
are allowed only from the monitoring host(s).

Monitoring hosts are speciļ¬ed as attributes in the base role.




        @gbagnoli              Introduzione a Chef              12/09/2012   40 / 50
Monitoring - Nodes (2)

(almost) Every cookbook pushes a MRPE or check mk plugin check to
the node, so the check mk agent returns data for all conļ¬gured services.

i.e. , in the mysql:: server recipe
mrpe_check "mysql" do
  script "check_mysql"
  variables(
    :passwd => node["mysql"]["server_root_password"],
    :checks => checks,
    :tunables => node["mysql"]["tunable"]
  )
end




           @gbagnoli                         Introduzione a Chef   12/09/2012   41 / 50
Monitoring - Nodes (2)

(almost) Every cookbook pushes a MRPE or check mk plugin check to
the node, so the check mk agent returns data for all conļ¬gured services.

i.e. , in the mysql:: server recipe
mrpe_check "mysql" do
  script "check_mysql"
  variables(
    :passwd => node["mysql"]["server_root_password"],
    :checks => checks,
    :tunables => node["mysql"]["tunable"]
  )
end

> telnet mysql-server.example.com 6556
[...]
<<<mrpe>>>
(check_mysql) mysql_idx 0 OK - index usage 53.60% | index_usage=53.60%;0:;0:
(check_mysql) mysql_running 0 OK - 0 long running processes | long_running_procs=0;10;20
(check_mysql) mysql_threads 0 OK - 18 client connection threads | threads_connected=18;80;95
[...]




           @gbagnoli                         Introduzione a Chef                        12/09/2012   41 / 50
Monitoring - Server


On the server, the check mk:: server recipe installs and conļ¬gures icinga,
nsca, nagvis, pnp4nagios smokeping and check mk.




       @gbagnoli               Introduzione a Chef          12/09/2012   42 / 50
Monitoring - Server


On the server, the check mk:: server recipe installs and conļ¬gures icinga,
nsca, nagvis, pnp4nagios smokeping and check mk.

The check mk conļ¬guration ļ¬le (which is used by check mk to conļ¬gure
active and passive checks in icinga) is managed as a template by the
recipe. The recipe use the search API to discover nodes using a
conļ¬gurable query.




       @gbagnoli               Introduzione a Chef          12/09/2012   42 / 50
Monitoring - Server


On the server, the check mk:: server recipe installs and conļ¬gures icinga,
nsca, nagvis, pnp4nagios smokeping and check mk.

The check mk conļ¬guration ļ¬le (which is used by check mk to conļ¬gure
active and passive checks in icinga) is managed as a template by the
recipe. The recipe use the search API to discover nodes using a
conļ¬gurable query.

nodes = search(:node, node["check_mk"]["search_query"])

default query:
     default [ā€check mkā€][ā€search queryā€] = ā€chef environment:productionā€




         @gbagnoli                 Introduzione a Chef              12/09/2012   42 / 50
Monitoring - Server (2)

So, when a node is promoted to production, as soon as chef runs on the
monitoring server,




       @gbagnoli              Introduzione a Chef          12/09/2012   43 / 50
Monitoring - Server (2)

So, when a node is promoted to production, as soon as chef runs on the
monitoring server,
  ā€¢ It adds the node to the check mk conf ļ¬le (the template is the same,
    but data has changed)




       @gbagnoli              Introduzione a Chef          12/09/2012   43 / 50
Monitoring - Server (2)

So, when a node is promoted to production, as soon as chef runs on the
monitoring server,
  ā€¢ It adds the node to the check mk conf ļ¬le (the template is the same,
    but data has changed)
  ā€¢ . . . the modiļ¬ed templates notiļ¬es the check mk write conf
    resource, which is queued




       @gbagnoli                Introduzione a Chef        12/09/2012   43 / 50
Monitoring - Server (2)

So, when a node is promoted to production, as soon as chef runs on the
monitoring server,
   ā€¢ It adds the node to the check mk conf ļ¬le (the template is the same,
      but data has changed)
   ā€¢ . . . the modiļ¬ed templates notiļ¬es the check mk write conf
      resource, which is queued
template "#{node[ā€™check_mkā€™][ā€™conf_dirā€™]}/main.mk" do
  source "check_mk_main.mk.erb"
  variables(
    :nodes => nodes,
    :hostgroups => hostgroups,
    :params => node[ā€™check_mkā€™][ā€™paramsā€™]
  )
  mode 0644
  owner "root"
  group "root"
  notifies :run, "execute[check_mk_write_conf]"
end




           @gbagnoli                         Introduzione a Chef   12/09/2012   43 / 50
Monitoring - Server (3)

The check mk write conf resource regenerates icinga conf




       @gbagnoli              Introduzione a Chef          12/09/2012   44 / 50
Monitoring - Server (3)

The check mk write conf resource regenerates icinga conf
execute "check_mk_write_conf" do
  command "#{node[ā€™check_mkā€™][ā€™prefixā€™]}/bin/check_mk -O"
  action :nothing
end




           @gbagnoli                         Introduzione a Chef   12/09/2012   44 / 50
Monitoring - Server (3)

The check mk write conf resource regenerates icinga conf
execute "check_mk_write_conf" do
  command "#{node[ā€™check_mkā€™][ā€™prefixā€™]}/bin/check_mk -O"
  action :nothing
end



Then the recipe scan nodes for services (using check mk inventory)
This is done only the ļ¬rst time (no reinventory)
nodes.each do |n|
  if not n[ā€™tagsā€™] or not n[ā€™tagsā€™].include? "noagent"
    check_mk_inventory n[ā€™fqdnā€™]
  end
end



check mk inventory is an LWRP deļ¬ned in the check mk cookbook




           @gbagnoli                         Introduzione a Chef   12/09/2012   44 / 50
Monitoring - Server (4)




That way new nodes are automatically added to the monitoring when they
show up as result of the search query.

Since cookbooks push and conļ¬gure check mk plugins, everything gets
monitored and
all the monitoring logic is in the cookbook itself.




       @gbagnoli             Introduzione a Chef         12/09/2012   45 / 50
Monitoring Chef Clients

Once you start relying on chef, you want to know if chef-client is
correctly running on nodes and if/when it fails.




       @gbagnoli              Introduzione a Chef         12/09/2012   46 / 50
Monitoring Chef Clients

Once you start relying on chef, you want to know if chef-client is
correctly running on nodes and if/when it fails.

Instead on relying on the active model of check mk, we use a completely
passive approach. We use NSCA for this.




       @gbagnoli              Introduzione a Chef          12/09/2012   46 / 50
Monitoring Chef Clients

Once you start relying on chef, you want to know if chef-client is
correctly running on nodes and if/when it fails.

Instead on relying on the active model of check mk, we use a completely
passive approach. We use NSCA for this.

When chef-client runs on the node, it pushes a report/exception
handler called NSCAHandler.
This handler runs at the end of a chef-client run, and submits the
result to the NSCA server on the monitoring host, so that:




       @gbagnoli              Introduzione a Chef          12/09/2012   46 / 50
Monitoring Chef Clients

Once you start relying on chef, you want to know if chef-client is
correctly running on nodes and if/when it fails.

Instead on relying on the active model of check mk, we use a completely
passive approach. We use NSCA for this.

When chef-client runs on the node, it pushes a report/exception
handler called NSCAHandler.
This handler runs at the end of a chef-client run, and submits the
result to the NSCA server on the monitoring host, so that:
  ā€¢ check is in critical state if chef run failed.
  ā€¢ check is in warning/critical state if time elapsed is above thresholds
  ā€¢ check is in warning/critical state if the number of modiļ¬ed resources
    is above thresholds


        @gbagnoli                Introduzione a Chef          12/09/2012   46 / 50
Monitoring Chef Clients (2)




Passive checks are created on the server for every node which runs the
chef-client

These checks have a freshness threshold of 1 day, so that if no data
arrives from the node the check will enter the UNKOWN state, meaning the
chef-client is not running on that node.




       @gbagnoli               Introduzione a Chef          12/09/2012   47 / 50
Monitoring - Final Words
The check mk:: server recipe also conļ¬gures:
   ā€¢ host parents
   ā€¢ host groups
   ā€¢ service groups
   ā€¢ notiļ¬cation periods for services
   ā€¢ contact groups and administrators (data is in the accounts data bag)
   ā€¢ uses smokeping to perfom hosts checks (instead of using check ping)
   ā€¢ . . . and integrates smokeping web ui with check mk multisite.
   ā€¢ host icon for the status map :-)

Behavior can be changed by setting nodes tag with knife. i.e, this changes
the notiļ¬cation period for a host.
knife tag create myhost.example.com workhours




           @gbagnoli                            Introduzione a Chef   12/09/2012   48 / 50
Questions?
Bagnoli Giacomo

g.bagnoli@asidev.com
twitter.com/@gbagnoli
github.com/gbagnoli
bitbucket.org/gbagnoli
gplus.to/gbagnoli




       @gbagnoli           Introduzione a Chef   12/09/2012   49 / 50
Thank you!




@gbagnoli     Introduzione a Chef   12/09/2012   50 / 50

More Related Content

What's hot

CI/CD źø°ė°˜ģ˜ Microservice ź°œė°œ
 CI/CD źø°ė°˜ģ˜ Microservice ź°œė°œ CI/CD źø°ė°˜ģ˜ Microservice ź°œė°œ
CI/CD źø°ė°˜ģ˜ Microservice ź°œė°œOracle Korea
Ā 
FAST for SharePoint Deep Dive
FAST for SharePoint Deep DiveFAST for SharePoint Deep Dive
FAST for SharePoint Deep Diveneil_richards
Ā 
Infrastructure Automation with Chef
Infrastructure Automation with Chef Infrastructure Automation with Chef
Infrastructure Automation with Chef REAN Cloud
Ā 
Chef - managing yours servers with Code
Chef - managing yours servers with CodeChef - managing yours servers with Code
Chef - managing yours servers with Codem_richardson
Ā 
Muraliupdatedpersona150716
Muraliupdatedpersona150716Muraliupdatedpersona150716
Muraliupdatedpersona150716Murali Krishna R
Ā 
'Full Stack Kotlin' Workshop at KotlinConf
'Full Stack Kotlin' Workshop at KotlinConf'Full Stack Kotlin' Workshop at KotlinConf
'Full Stack Kotlin' Workshop at KotlinConfGarth Gilmour
Ā 
JUC Europe 2015: Scaling of Jenkins Pipeline Creation and Maintenance
JUC Europe 2015: Scaling of Jenkins Pipeline Creation and MaintenanceJUC Europe 2015: Scaling of Jenkins Pipeline Creation and Maintenance
JUC Europe 2015: Scaling of Jenkins Pipeline Creation and MaintenanceCloudBees
Ā 
Java APIs - the missing manual
Java APIs - the missing manualJava APIs - the missing manual
Java APIs - the missing manualHendrik Ebbers
Ā 
JavaEE & GlassFish UG - Digital JavaEE 7 New & Noteworthy by P.Pilgrim
JavaEE & GlassFish UG - Digital JavaEE 7 New & Noteworthy by P.PilgrimJavaEE & GlassFish UG - Digital JavaEE 7 New & Noteworthy by P.Pilgrim
JavaEE & GlassFish UG - Digital JavaEE 7 New & Noteworthy by P.PilgrimPayara
Ā 
2015 JavaOne EJB/CDI Alignment
2015 JavaOne EJB/CDI Alignment2015 JavaOne EJB/CDI Alignment
2015 JavaOne EJB/CDI AlignmentDavid Blevins
Ā 
Codecoon - A technical Case Study
Codecoon - A technical Case StudyCodecoon - A technical Case Study
Codecoon - A technical Case StudyMichael Lihs
Ā 
50 New Features of Java EE 7 in 50 minutes
50 New Features of Java EE 7 in 50 minutes50 New Features of Java EE 7 in 50 minutes
50 New Features of Java EE 7 in 50 minutesArun Gupta
Ā 
Oracle WebLogic Server 12.2.1 Do More with Less
Oracle WebLogic Server 12.2.1 Do More with LessOracle WebLogic Server 12.2.1 Do More with Less
Oracle WebLogic Server 12.2.1 Do More with LessEd Burns
Ā 
Plugin architecture (Extensible Application Architecture)
Plugin architecture (Extensible Application Architecture)Plugin architecture (Extensible Application Architecture)
Plugin architecture (Extensible Application Architecture)Chinmoy Mohanty
Ā 
Continuous Delivery for Mobile R&D
Continuous Delivery for Mobile R&DContinuous Delivery for Mobile R&D
Continuous Delivery for Mobile R&DAnton Weiss
Ā 

What's hot (16)

CI/CD źø°ė°˜ģ˜ Microservice ź°œė°œ
 CI/CD źø°ė°˜ģ˜ Microservice ź°œė°œ CI/CD źø°ė°˜ģ˜ Microservice ź°œė°œ
CI/CD źø°ė°˜ģ˜ Microservice ź°œė°œ
Ā 
FAST for SharePoint Deep Dive
FAST for SharePoint Deep DiveFAST for SharePoint Deep Dive
FAST for SharePoint Deep Dive
Ā 
Infrastructure Automation with Chef
Infrastructure Automation with Chef Infrastructure Automation with Chef
Infrastructure Automation with Chef
Ā 
Chef - managing yours servers with Code
Chef - managing yours servers with CodeChef - managing yours servers with Code
Chef - managing yours servers with Code
Ā 
Muraliupdatedpersona150716
Muraliupdatedpersona150716Muraliupdatedpersona150716
Muraliupdatedpersona150716
Ā 
'Full Stack Kotlin' Workshop at KotlinConf
'Full Stack Kotlin' Workshop at KotlinConf'Full Stack Kotlin' Workshop at KotlinConf
'Full Stack Kotlin' Workshop at KotlinConf
Ā 
JUC Europe 2015: Scaling of Jenkins Pipeline Creation and Maintenance
JUC Europe 2015: Scaling of Jenkins Pipeline Creation and MaintenanceJUC Europe 2015: Scaling of Jenkins Pipeline Creation and Maintenance
JUC Europe 2015: Scaling of Jenkins Pipeline Creation and Maintenance
Ā 
Java APIs - the missing manual
Java APIs - the missing manualJava APIs - the missing manual
Java APIs - the missing manual
Ā 
JavaEE & GlassFish UG - Digital JavaEE 7 New & Noteworthy by P.Pilgrim
JavaEE & GlassFish UG - Digital JavaEE 7 New & Noteworthy by P.PilgrimJavaEE & GlassFish UG - Digital JavaEE 7 New & Noteworthy by P.Pilgrim
JavaEE & GlassFish UG - Digital JavaEE 7 New & Noteworthy by P.Pilgrim
Ā 
2015 JavaOne EJB/CDI Alignment
2015 JavaOne EJB/CDI Alignment2015 JavaOne EJB/CDI Alignment
2015 JavaOne EJB/CDI Alignment
Ā 
Codecoon - A technical Case Study
Codecoon - A technical Case StudyCodecoon - A technical Case Study
Codecoon - A technical Case Study
Ā 
Servlet programming
Servlet programmingServlet programming
Servlet programming
Ā 
50 New Features of Java EE 7 in 50 minutes
50 New Features of Java EE 7 in 50 minutes50 New Features of Java EE 7 in 50 minutes
50 New Features of Java EE 7 in 50 minutes
Ā 
Oracle WebLogic Server 12.2.1 Do More with Less
Oracle WebLogic Server 12.2.1 Do More with LessOracle WebLogic Server 12.2.1 Do More with Less
Oracle WebLogic Server 12.2.1 Do More with Less
Ā 
Plugin architecture (Extensible Application Architecture)
Plugin architecture (Extensible Application Architecture)Plugin architecture (Extensible Application Architecture)
Plugin architecture (Extensible Application Architecture)
Ā 
Continuous Delivery for Mobile R&D
Continuous Delivery for Mobile R&DContinuous Delivery for Mobile R&D
Continuous Delivery for Mobile R&D
Ā 

Viewers also liked

Docker dev ops for cd meetup 12-14
Docker dev ops for cd meetup 12-14Docker dev ops for cd meetup 12-14
Docker dev ops for cd meetup 12-14Simon Storm
Ā 
Streamline your development environment with docker
Streamline your development environment with dockerStreamline your development environment with docker
Streamline your development environment with dockerGiacomo Bagnoli
Ā 
How Docker Accelerates Continuous Development at Codefresh
How Docker Accelerates Continuous Development at CodefreshHow Docker Accelerates Continuous Development at Codefresh
How Docker Accelerates Continuous Development at CodefreshCodefresh
Ā 
Codefresh + Cloud 66 webinar: Testing Strategies for Docker Driven Development
Codefresh + Cloud 66 webinar: Testing Strategies for Docker Driven DevelopmentCodefresh + Cloud 66 webinar: Testing Strategies for Docker Driven Development
Codefresh + Cloud 66 webinar: Testing Strategies for Docker Driven DevelopmentCodefresh
Ā 
Codefresh + BlazeMeter Webinar: Continuous Testing for Containerized Applicat...
Codefresh + BlazeMeter Webinar: Continuous Testing for Containerized Applicat...Codefresh + BlazeMeter Webinar: Continuous Testing for Containerized Applicat...
Codefresh + BlazeMeter Webinar: Continuous Testing for Containerized Applicat...Codefresh
Ā 
Docker driven development pipeline webinar (1)
Docker driven development pipeline webinar (1)Docker driven development pipeline webinar (1)
Docker driven development pipeline webinar (1)Codefresh
Ā 
Docker for Developers: Dev, Test, Deploy @ BucksCo Devops at MeetMe HQ
Docker for Developers: Dev, Test, Deploy @ BucksCo Devops at MeetMe HQDocker for Developers: Dev, Test, Deploy @ BucksCo Devops at MeetMe HQ
Docker for Developers: Dev, Test, Deploy @ BucksCo Devops at MeetMe HQErica Windisch
Ā 
Containers #101 Meetup: Containers and OpenStack
Containers #101 Meetup: Containers and OpenStackContainers #101 Meetup: Containers and OpenStack
Containers #101 Meetup: Containers and OpenStackCodefresh
Ā 
Chef Cookbook Testing and Continuous Integration
Chef Cookbook Testing and Continuous IntegrationChef Cookbook Testing and Continuous Integration
Chef Cookbook Testing and Continuous IntegrationJulian Dunn
Ā 
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of ChefChef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of ChefChef Software, Inc.
Ā 
Overview of Chef - Fundamentals Webinar Series Part 1
Overview of Chef - Fundamentals Webinar Series Part 1Overview of Chef - Fundamentals Webinar Series Part 1
Overview of Chef - Fundamentals Webinar Series Part 1Chef
Ā 
Intro to Codefresh YAML
Intro to Codefresh YAML  Intro to Codefresh YAML
Intro to Codefresh YAML Codefresh
Ā 

Viewers also liked (12)

Docker dev ops for cd meetup 12-14
Docker dev ops for cd meetup 12-14Docker dev ops for cd meetup 12-14
Docker dev ops for cd meetup 12-14
Ā 
Streamline your development environment with docker
Streamline your development environment with dockerStreamline your development environment with docker
Streamline your development environment with docker
Ā 
How Docker Accelerates Continuous Development at Codefresh
How Docker Accelerates Continuous Development at CodefreshHow Docker Accelerates Continuous Development at Codefresh
How Docker Accelerates Continuous Development at Codefresh
Ā 
Codefresh + Cloud 66 webinar: Testing Strategies for Docker Driven Development
Codefresh + Cloud 66 webinar: Testing Strategies for Docker Driven DevelopmentCodefresh + Cloud 66 webinar: Testing Strategies for Docker Driven Development
Codefresh + Cloud 66 webinar: Testing Strategies for Docker Driven Development
Ā 
Codefresh + BlazeMeter Webinar: Continuous Testing for Containerized Applicat...
Codefresh + BlazeMeter Webinar: Continuous Testing for Containerized Applicat...Codefresh + BlazeMeter Webinar: Continuous Testing for Containerized Applicat...
Codefresh + BlazeMeter Webinar: Continuous Testing for Containerized Applicat...
Ā 
Docker driven development pipeline webinar (1)
Docker driven development pipeline webinar (1)Docker driven development pipeline webinar (1)
Docker driven development pipeline webinar (1)
Ā 
Docker for Developers: Dev, Test, Deploy @ BucksCo Devops at MeetMe HQ
Docker for Developers: Dev, Test, Deploy @ BucksCo Devops at MeetMe HQDocker for Developers: Dev, Test, Deploy @ BucksCo Devops at MeetMe HQ
Docker for Developers: Dev, Test, Deploy @ BucksCo Devops at MeetMe HQ
Ā 
Containers #101 Meetup: Containers and OpenStack
Containers #101 Meetup: Containers and OpenStackContainers #101 Meetup: Containers and OpenStack
Containers #101 Meetup: Containers and OpenStack
Ā 
Chef Cookbook Testing and Continuous Integration
Chef Cookbook Testing and Continuous IntegrationChef Cookbook Testing and Continuous Integration
Chef Cookbook Testing and Continuous Integration
Ā 
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of ChefChef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of Chef
Ā 
Overview of Chef - Fundamentals Webinar Series Part 1
Overview of Chef - Fundamentals Webinar Series Part 1Overview of Chef - Fundamentals Webinar Series Part 1
Overview of Chef - Fundamentals Webinar Series Part 1
Ā 
Intro to Codefresh YAML
Intro to Codefresh YAML  Intro to Codefresh YAML
Intro to Codefresh YAML
Ā 

Similar to Intro to Chef

Infrastructure-As-Code and Cloud Deployments with Opscode Chef & Co
Infrastructure-As-Code and Cloud Deployments with Opscode Chef & CoInfrastructure-As-Code and Cloud Deployments with Opscode Chef & Co
Infrastructure-As-Code and Cloud Deployments with Opscode Chef & CoTorben Knerr
Ā 
Apigility-powered API's on IBM i
Apigility-powered API's on IBM iApigility-powered API's on IBM i
Apigility-powered API's on IBM ichukShirley
Ā 
London Community Summit 2016 - Fresh New Chef Stuff
London Community Summit 2016 - Fresh New Chef StuffLondon Community Summit 2016 - Fresh New Chef Stuff
London Community Summit 2016 - Fresh New Chef StuffChef
Ā 
AEM and Sling
AEM and SlingAEM and Sling
AEM and SlingLo Ki
Ā 
AEM and Sling
AEM and SlingAEM and Sling
AEM and SlingLokesh BS
Ā 
Designing your API Server for mobile apps
Designing your API Server for mobile appsDesigning your API Server for mobile apps
Designing your API Server for mobile appsMugunth Kumar
Ā 
Chef onlinuxonpower
Chef onlinuxonpowerChef onlinuxonpower
Chef onlinuxonpowerMoya Brannan
Ā 
Boot camp 2010_app_engine_101
Boot camp 2010_app_engine_101Boot camp 2010_app_engine_101
Boot camp 2010_app_engine_101ikailan
Ā 
HiveServer2 for Apache Hive
HiveServer2 for Apache HiveHiveServer2 for Apache Hive
HiveServer2 for Apache HiveCarl Steinbach
Ā 
HLoader ā€“ Automated Incremental Hadoop Data Loader Service and Framework
HLoader ā€“ Automated Incremental Hadoop Data Loader Service and FrameworkHLoader ā€“ Automated Incremental Hadoop Data Loader Service and Framework
HLoader ā€“ Automated Incremental Hadoop Data Loader Service and FrameworkDĆ”niel Stein
Ā 
Automating your OpenStack environment with Chef, Puppet and Cloudify
Automating your OpenStack environment with Chef, Puppet and Cloudify Automating your OpenStack environment with Chef, Puppet and Cloudify
Automating your OpenStack environment with Chef, Puppet and Cloudify Nati Shalom
Ā 
Getting Started with the WSO2 manager
Getting Started with the WSO2  managerGetting Started with the WSO2  manager
Getting Started with the WSO2 managerWSO2
Ā 
Restful web services rule financial
Restful web services   rule financialRestful web services   rule financial
Restful web services rule financialRule_Financial
Ā 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with PerlDave Cross
Ā 
Apic dc api deep dive
Apic dc api deep dive Apic dc api deep dive
Apic dc api deep dive Cisco DevNet
Ā 
Devops Days, 2019 - Charlotte
Devops Days, 2019 - CharlotteDevops Days, 2019 - Charlotte
Devops Days, 2019 - Charlottebotsplash.com
Ā 
Collaborative Contract Driven Development
Collaborative Contract Driven DevelopmentCollaborative Contract Driven Development
Collaborative Contract Driven DevelopmentBilly Korando
Ā 
Building A SaaS with CoreOS, Docker, and Etcd
Building A SaaS with CoreOS, Docker, and EtcdBuilding A SaaS with CoreOS, Docker, and Etcd
Building A SaaS with CoreOS, Docker, and EtcdRoss Kukulinski
Ā 
Chef conf-2015-chef-patterns-at-bloomberg-scale
Chef conf-2015-chef-patterns-at-bloomberg-scaleChef conf-2015-chef-patterns-at-bloomberg-scale
Chef conf-2015-chef-patterns-at-bloomberg-scaleBiju Nair
Ā 

Similar to Intro to Chef (20)

Infrastructure-As-Code and Cloud Deployments with Opscode Chef & Co
Infrastructure-As-Code and Cloud Deployments with Opscode Chef & CoInfrastructure-As-Code and Cloud Deployments with Opscode Chef & Co
Infrastructure-As-Code and Cloud Deployments with Opscode Chef & Co
Ā 
Apigility-powered API's on IBM i
Apigility-powered API's on IBM iApigility-powered API's on IBM i
Apigility-powered API's on IBM i
Ā 
London Community Summit 2016 - Fresh New Chef Stuff
London Community Summit 2016 - Fresh New Chef StuffLondon Community Summit 2016 - Fresh New Chef Stuff
London Community Summit 2016 - Fresh New Chef Stuff
Ā 
AEM and Sling
AEM and SlingAEM and Sling
AEM and Sling
Ā 
AEM and Sling
AEM and SlingAEM and Sling
AEM and Sling
Ā 
Designing your API Server for mobile apps
Designing your API Server for mobile appsDesigning your API Server for mobile apps
Designing your API Server for mobile apps
Ā 
Chef onlinuxonpower
Chef onlinuxonpowerChef onlinuxonpower
Chef onlinuxonpower
Ā 
Boot camp 2010_app_engine_101
Boot camp 2010_app_engine_101Boot camp 2010_app_engine_101
Boot camp 2010_app_engine_101
Ā 
HiveServer2 for Apache Hive
HiveServer2 for Apache HiveHiveServer2 for Apache Hive
HiveServer2 for Apache Hive
Ā 
HLoader ā€“ Automated Incremental Hadoop Data Loader Service and Framework
HLoader ā€“ Automated Incremental Hadoop Data Loader Service and FrameworkHLoader ā€“ Automated Incremental Hadoop Data Loader Service and Framework
HLoader ā€“ Automated Incremental Hadoop Data Loader Service and Framework
Ā 
Automating your OpenStack environment with Chef, Puppet and Cloudify
Automating your OpenStack environment with Chef, Puppet and Cloudify Automating your OpenStack environment with Chef, Puppet and Cloudify
Automating your OpenStack environment with Chef, Puppet and Cloudify
Ā 
Getting Started with the WSO2 manager
Getting Started with the WSO2  managerGetting Started with the WSO2  manager
Getting Started with the WSO2 manager
Ā 
Restful web services rule financial
Restful web services   rule financialRestful web services   rule financial
Restful web services rule financial
Ā 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with Perl
Ā 
Apic dc api deep dive
Apic dc api deep dive Apic dc api deep dive
Apic dc api deep dive
Ā 
Data science lifecycle with Apache Zeppelin
Data science lifecycle with Apache ZeppelinData science lifecycle with Apache Zeppelin
Data science lifecycle with Apache Zeppelin
Ā 
Devops Days, 2019 - Charlotte
Devops Days, 2019 - CharlotteDevops Days, 2019 - Charlotte
Devops Days, 2019 - Charlotte
Ā 
Collaborative Contract Driven Development
Collaborative Contract Driven DevelopmentCollaborative Contract Driven Development
Collaborative Contract Driven Development
Ā 
Building A SaaS with CoreOS, Docker, and Etcd
Building A SaaS with CoreOS, Docker, and EtcdBuilding A SaaS with CoreOS, Docker, and Etcd
Building A SaaS with CoreOS, Docker, and Etcd
Ā 
Chef conf-2015-chef-patterns-at-bloomberg-scale
Chef conf-2015-chef-patterns-at-bloomberg-scaleChef conf-2015-chef-patterns-at-bloomberg-scale
Chef conf-2015-chef-patterns-at-bloomberg-scale
Ā 

Recently uploaded

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
Ā 
Finology Group ā€“ Insurtech Innovation Award 2024
Finology Group ā€“ Insurtech Innovation Award 2024Finology Group ā€“ Insurtech Innovation Award 2024
Finology Group ā€“ Insurtech Innovation Award 2024The Digital Insurer
Ā 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
Ā 
šŸ¬ The future of MySQL is Postgres šŸ˜
šŸ¬  The future of MySQL is Postgres   šŸ˜šŸ¬  The future of MySQL is Postgres   šŸ˜
šŸ¬ The future of MySQL is Postgres šŸ˜RTylerCroy
Ā 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel AraĆŗjo
Ā 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
Ā 
Scaling API-first ā€“ The story of a global engineering organization
Scaling API-first ā€“ The story of a global engineering organizationScaling API-first ā€“ The story of a global engineering organization
Scaling API-first ā€“ The story of a global engineering organizationRadu Cotescu
Ā 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
Ā 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
Ā 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
Ā 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
Ā 
WhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
Ā 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
Ā 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
Ā 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
Ā 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
Ā 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
Ā 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
Ā 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
Ā 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service šŸø 8923113531 šŸŽ° Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service šŸø 8923113531 šŸŽ° Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service šŸø 8923113531 šŸŽ° Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service šŸø 8923113531 šŸŽ° Avail...gurkirankumar98700
Ā 

Recently uploaded (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
Ā 
Finology Group ā€“ Insurtech Innovation Award 2024
Finology Group ā€“ Insurtech Innovation Award 2024Finology Group ā€“ Insurtech Innovation Award 2024
Finology Group ā€“ Insurtech Innovation Award 2024
Ā 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
Ā 
šŸ¬ The future of MySQL is Postgres šŸ˜
šŸ¬  The future of MySQL is Postgres   šŸ˜šŸ¬  The future of MySQL is Postgres   šŸ˜
šŸ¬ The future of MySQL is Postgres šŸ˜
Ā 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Ā 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
Ā 
Scaling API-first ā€“ The story of a global engineering organization
Scaling API-first ā€“ The story of a global engineering organizationScaling API-first ā€“ The story of a global engineering organization
Scaling API-first ā€“ The story of a global engineering organization
Ā 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
Ā 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Ā 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Ā 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
Ā 
WhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 āœ“Call Girls In Kalyan ( Mumbai ) secure service
Ā 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
Ā 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Ā 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Ā 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
Ā 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Ā 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
Ā 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
Ā 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service šŸø 8923113531 šŸŽ° Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service šŸø 8923113531 šŸŽ° Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service šŸø 8923113531 šŸŽ° Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service šŸø 8923113531 šŸŽ° Avail...
Ā 

Intro to Chef

  • 1. Introduzione a Chef Giacomo Bagnoli Develer Workshops - 12 Settembre 2012 @gbagnoli Introduzione a Chef 12/09/2012 1 / 50
  • 2. # whoami ā€¢ System Administrator ā€¢ Operations Engineer ā€¢ Python guy (having an aļ¬€air with Ruby) @gbagnoli Introduzione a Chef 12/09/2012 2 / 50
  • 3. Outline 1. Introduction 2. Chef Overview 3. Example @gbagnoli Introduzione a Chef 12/09/2012 3 / 50
  • 4. Introduction @gbagnoli Introduzione a Chef 12/09/2012 4 / 50
  • 5. Infrastructure as code Building and managing infrastructure programmatically @gbagnoli Introduzione a Chef 12/09/2012 5 / 50
  • 6. Infrastructure as code Building and managing infrastructure programmatically Enable the reconstruction of the business from: @gbagnoli Introduzione a Chef 12/09/2012 5 / 50
  • 7. Infrastructure as code Building and managing infrastructure programmatically Enable the reconstruction of the business from: ā€¢ computing resources @gbagnoli Introduzione a Chef 12/09/2012 5 / 50
  • 8. Infrastructure as code Building and managing infrastructure programmatically Enable the reconstruction of the business from: ā€¢ computing resources ā€¢ a source code repository @gbagnoli Introduzione a Chef 12/09/2012 5 / 50
  • 9. Infrastructure as code Building and managing infrastructure programmatically Enable the reconstruction of the business from: ā€¢ computing resources ā€¢ a source code repository ā€¢ data backups @gbagnoli Introduzione a Chef 12/09/2012 5 / 50
  • 10. Infrastructure as code (2) source: Chef wiki Provisioning Get new computing resources Conļ¬guration Management Keeps track of all steps required to take bare metal resources to doing their job System Integration Takes all conļ¬gured systems and make them work together. @gbagnoli Introduzione a Chef 12/09/2012 6 / 50
  • 11. What is Chef @gbagnoli Introduzione a Chef 12/09/2012 7 / 50
  • 12. What is Chef ā€¢ A library/framework for conļ¬guration management @gbagnoli Introduzione a Chef 12/09/2012 7 / 50
  • 13. What is Chef ā€¢ A library/framework for conļ¬guration management ā€¢ A conļ¬guration management system @gbagnoli Introduzione a Chef 12/09/2012 7 / 50
  • 14. What is Chef ā€¢ A library/framework for conļ¬guration management ā€¢ A conļ¬guration management system ā€¢ A system integration platform @gbagnoli Introduzione a Chef 12/09/2012 7 / 50
  • 15. What is Chef ā€¢ A library/framework for conļ¬guration management ā€¢ A conļ¬guration management system ā€¢ A system integration platform ā€¢ An API for the infrastructure @gbagnoli Introduzione a Chef 12/09/2012 7 / 50
  • 16. What is Chef ā€¢ A library/framework for conļ¬guration management ā€¢ A conļ¬guration management system ā€¢ A system integration platform ā€¢ An API for the infrastructure ā€¢ Open Source! (Apache License, version 2.0) @gbagnoli Introduzione a Chef 12/09/2012 7 / 50
  • 17. Opscode Chef @gbagnoli Introduzione a Chef 12/09/2012 8 / 50
  • 18. Chef Principles @gbagnoli Introduzione a Chef 12/09/2012 9 / 50
  • 19. Chef Principles Idempotent Describes states @gbagnoli Introduzione a Chef 12/09/2012 9 / 50
  • 20. Chef Principles Idempotent Describes states Extensible Uses ruby as the DSL @gbagnoli Introduzione a Chef 12/09/2012 9 / 50
  • 21. Chef Principles Idempotent Describes states Extensible Uses ruby as the DSL Order It matters @gbagnoli Introduzione a Chef 12/09/2012 9 / 50
  • 22. Chef Principles Idempotent Describes states Extensible Uses ruby as the DSL Order It matters Client-Server Thick Clients, thin Server @gbagnoli Introduzione a Chef 12/09/2012 9 / 50
  • 23. Chef Principles Idempotent Describes states Extensible Uses ruby as the DSL Order It matters Client-Server Thick Clients, thin Server Various Flavours: @gbagnoli Introduzione a Chef 12/09/2012 9 / 50
  • 24. Chef Principles Idempotent Describes states Extensible Uses ruby as the DSL Order It matters Client-Server Thick Clients, thin Server Various Flavours: ā€¢ Hosted on Opscode platform (chef-hosted) @gbagnoli Introduzione a Chef 12/09/2012 9 / 50
  • 25. Chef Principles Idempotent Describes states Extensible Uses ruby as the DSL Order It matters Client-Server Thick Clients, thin Server Various Flavours: ā€¢ Hosted on Opscode platform (chef-hosted) ā€¢ Open source Chef Server @gbagnoli Introduzione a Chef 12/09/2012 9 / 50
  • 26. Chef Principles Idempotent Describes states Extensible Uses ruby as the DSL Order It matters Client-Server Thick Clients, thin Server Various Flavours: ā€¢ Hosted on Opscode platform (chef-hosted) ā€¢ Open source Chef Server ā€¢ Serverless - chef-solo @gbagnoli Introduzione a Chef 12/09/2012 9 / 50
  • 27. Chef Principles Idempotent Describes states Extensible Uses ruby as the DSL Order It matters Client-Server Thick Clients, thin Server Various Flavours: ā€¢ Hosted on Opscode platform (chef-hosted) ā€¢ Open source Chef Server ā€¢ Serverless - chef-solo ā€¢ Private Chef (opscode-supported behind-the-ļ¬rewall installation) @gbagnoli Introduzione a Chef 12/09/2012 9 / 50
  • 28. Chef API ā€¢ A RESTful service with JSON responses ā€¢ RSA key authentication with Signed Headers ā€¢ Search Service ā€¢ Derivative (easy to integrate with other tools) ā€¢ . . . i.e pychef :-) @gbagnoli Introduzione a Chef 12/09/2012 10 / 50
  • 29. Chef API ā€¢ A RESTful service with JSON responses ā€¢ RSA key authentication with Signed Headers ā€¢ Search Service ā€¢ Derivative (easy to integrate with other tools) ā€¢ . . . i.e pychef :-) chef-client connects to the server consuming the API. CLI management tool knife and the webUI use the API too. @gbagnoli Introduzione a Chef 12/09/2012 10 / 50
  • 30. Chef Architecture Solr CouchDB Indexer RabbitMQ Chef API Server Chef WebUI Client Client Client Knife Knife @gbagnoli Introduzione a Chef 12/09/2012 11 / 50
  • 31. API Client In chef, an API client provides the identity used to authenticate requests to the API server. @gbagnoli Introduzione a Chef 12/09/2012 12 / 50
  • 32. API Client In chef, an API client provides the identity used to authenticate requests to the API server. The public half of the public/private of a key pair is stored in the db on the server, while the private part is local to the client. @gbagnoli Introduzione a Chef 12/09/2012 12 / 50
  • 33. API Client In chef, an API client provides the identity used to authenticate requests to the API server. The public half of the public/private of a key pair is stored in the db on the server, while the private part is local to the client. Each request to the API contains a request signature in the HTTP headers. The request signature is computed by the hash of the request content and encrypted with the client private key, so itā€™s possible to verify the identity of the user/machine making the request. @gbagnoli Introduzione a Chef 12/09/2012 12 / 50
  • 34. Nodes A Node is a host that runs the chef-client. ā€¢ Has attributes ā€¢ Has a run list ā€¢ Has 0+ roles ā€¢ Belongs to an environment In the common case, 1 host ā‡” 1 node ā‡” 1 client @gbagnoli Introduzione a Chef 12/09/2012 13 / 50
  • 35. run list "run_list": { "role[python_hosting]", "recipe[postgresql::client]", "recipe[chishop]" } @gbagnoli Introduzione a Chef 12/09/2012 14 / 50
  • 36. Roles ā€¢ Have attributes ā€¢ Have a run list ā€¢ Declared in JSON or . . . ā€¢ Declared with the ruby DSL (automatically compiled to JSON) @gbagnoli Introduzione a Chef 12/09/2012 15 / 50
  • 37. Roles ā€¢ Have attributes ā€¢ Have a run list ā€¢ Declared in JSON or . . . ā€¢ Declared with the ruby DSL (automatically compiled to JSON) If 1+ roles are in the node run list, the node run list is expanded @gbagnoli Introduzione a Chef 12/09/2012 15 / 50
  • 38. Roles (2) An example role (in ruby): name "python_hosting" description "Python App hosting" default_attributes( "nginx" => { "default_site_enabled" => false } ) run_list( "recipe[python::virtualenv]", "recipe[uwsgi]", "recipe[nginx]" ) @gbagnoli Introduzione a Chef 12/09/2012 16 / 50
  • 39. Attributes Store node data (i.e. ip address, hostname, fqdn, database host address, etc.) There are four types of attributes (in order of precedence, lowest to highest): ā€¢ default ā€¢ normal ā€¢ override ā€¢ automatic @gbagnoli Introduzione a Chef 12/09/2012 17 / 50
  • 40. Attributes Store node data (i.e. ip address, hostname, fqdn, database host address, etc.) There are four types of attributes (in order of precedence, lowest to highest): ā€¢ default ā€¢ normal ā€¢ override ā€¢ automatic Attributes can be set in: ā€¢ cookbooks ā€¢ environments ā€¢ roles ā€¢ nodes @gbagnoli Introduzione a Chef 12/09/2012 17 / 50
  • 41. Attributes (2) So, in the end, as attributes are deep-merged, the following precedence applies: @gbagnoli Introduzione a Chef 12/09/2012 18 / 50
  • 42. Attributes (2) So, in the end, as attributes are deep-merged, the following precedence applies: ā€¢ default attributes applied in an cookbook ā€¢ default attributes applied in an environment ā€¢ default attributes applied in a role ā€¢ default attributes applied on a node directly in a recipe ā€¢ normal attributes applied in a cookbook ā€¢ normal attributes applied on a node directly in a recipe ā€¢ override attributes applied in an cookbook ā€¢ override attributes applied in an environment ā€¢ override attributes applied in a role ā€¢ override attributes applied on a node directly in a recipe ā€¢ automatic attributes generated by Ohai @gbagnoli Introduzione a Chef 12/09/2012 18 / 50
  • 43. Attributes (3) Automatic, ovverride and default are reset at the beginning of every run. Normal attributes persist between runs. @gbagnoli Introduzione a Chef 12/09/2012 19 / 50
  • 44. Attributes (3) Automatic, ovverride and default are reset at the beginning of every run. Normal attributes persist between runs. Attributes are searchable: search(:node, ā€™platform:ubuntuā€™) or knife search node "platform:ubuntu" @gbagnoli Introduzione a Chef 12/09/2012 19 / 50
  • 45. Attributes (4) Summary: @gbagnoli Introduzione a Chef 12/09/2012 20 / 50
  • 46. Attributes (4) Summary: ā€¢ (sane) defaults in cookbooks @gbagnoli Introduzione a Chef 12/09/2012 20 / 50
  • 47. Attributes (4) Summary: ā€¢ (sane) defaults in cookbooks ā€¢ . . . overridden in roles @gbagnoli Introduzione a Chef 12/09/2012 20 / 50
  • 48. Attributes (4) Summary: ā€¢ (sane) defaults in cookbooks ā€¢ . . . overridden in roles ā€¢ . . . and node-speciļ¬c data as normal attributes on the node. @gbagnoli Introduzione a Chef 12/09/2012 20 / 50
  • 49. Attributes (4) Summary: ā€¢ (sane) defaults in cookbooks ā€¢ . . . overridden in roles ā€¢ . . . and node-speciļ¬c data as normal attributes on the node. ā€¢ override and node.set can be used to force values @gbagnoli Introduzione a Chef 12/09/2012 20 / 50
  • 50. Resources Chef manages resources on a node. @gbagnoli Introduzione a Chef 12/09/2012 21 / 50
  • 51. Resources Chef manages resources on a node. Resources are speciļ¬ed in recipes, recipes stored in cookbooks. @gbagnoli Introduzione a Chef 12/09/2012 21 / 50
  • 52. Resources Chef manages resources on a node. Resources are speciļ¬ed in recipes, recipes stored in cookbooks. The expanded run list speciļ¬es all the recipes (and thus the resources) to manage on a given node. @gbagnoli Introduzione a Chef 12/09/2012 21 / 50
  • 53. Resources (2) A resource ā€¢ has a type package "tar" do ā€¢ has a name version "1.16.1-1" action :install ā€¢ has parameters end ā€¢ takes actions @gbagnoli Introduzione a Chef 12/09/2012 22 / 50
  • 54. Resources (2) A resource ā€¢ has a type package "tar" do ā€¢ has a name version "1.16.1-1" action :install ā€¢ has parameters end ā€¢ takes actions Actions are taken using providers, providers are chosen based on the node platform. (i.e. the package resource installs packages using apt on debian/ubuntu and using yum on centos/RHEL)! @gbagnoli Introduzione a Chef 12/09/2012 22 / 50
  • 55. Recipes Recipes evaluate resources in the order they appear package "pdns-recursor" do action :install end template "#{node[:pdns][:confd]}/recursor.conf" do source "recursor.cfg.erb" owner "root" group "root" mode 0644 notifies :restart, "service[pdns-recursor]" end service "pdns-recursor" do action [:enable, :start] end @gbagnoli Introduzione a Chef 12/09/2012 23 / 50
  • 56. Recipes (2) Recipes can include other resources, and are just ruby code include_recipe "apache2" ... %w{config logs files}.each do |dir| directory "#{node[:myrecipe][:base_dir]}/#{dir}" do recursive true owner "myuser" group "mygroup" mode 02775 end end @gbagnoli Introduzione a Chef 12/09/2012 24 / 50
  • 57. Cookbooks Cookbooks are (shareable) packages for recipes. Cookbooks for chef ā‡” gems for ruby cookbooks / python / | - - attributes | ā€˜-- default . rb | - - files | ā€˜-- default | - - LICENSE | - - metadata . rb | - - providers | | - - pip . rb | ā€˜-- virtualenv . rb | - - README . md | - - recipes | | - - default . rb | | - - package . rb | | - - pip . rb | | - - source . rb | ā€˜-- virtualenv . rb | - - resources | | - - pip . rb | ā€˜-- virtualenv . rb ā€˜-- templates ā€˜-- default ā€˜-- p r o f i l e _ v i r t u a l e n v w r a p p e r . sh . erb @gbagnoli Introduzione a Chef 12/09/2012 25 / 50
  • 58. Cookbooks (2) Currently 133 cookbooks available on opscode-cookbooks GitHub org. too many to list them all! https://github.com/opscode-cookbooks More cookbooks on the community site at http://community.opscode.com/cookbooks @gbagnoli Introduzione a Chef 12/09/2012 26 / 50
  • 59. Metadata maintainer "Opscode, Inc." maintainer_email "cookbooks@opscode.com" license "Apache 2.0" description "Installs and configures mysql for client or server" long_description IO.read(File.join(File.dirname(__FILE__), ā€™README.mdā€™)) version "1.2.5" recipe "mysql", "Includes the client recipe to configure a client" recipe "mysql::client", "Installs packages required for mysql clients using run_action magic" recipe "mysql::server", "Installs packages required for mysql servers w/o manual intervention" recipe "mysql::server_ec2", "Performs EC2-specific mountpoint manipulation" %w{ debian ubuntu centos suse fedora redhat scientific amazon }.each do |os| supports os end @gbagnoli Introduzione a Chef 12/09/2012 27 / 50
  • 60. Environments Environments can be used to manage diļ¬€erent environments (production, test, etc) in a single Chef setup. Roles can have diļ¬€erent run list on diļ¬€erent environments @gbagnoli Introduzione a Chef 12/09/2012 28 / 50
  • 61. Environments Environments can be used to manage diļ¬€erent environments (production, test, etc) in a single Chef setup. Roles can have diļ¬€erent run list on diļ¬€erent environments name "production" description "The production environment" cookbook_versions( "mysql" => "= 1.2.5", # use version 1.2.5 only "apache2" => "~> 1.1" # anything 1.1.0 < x < 1.2.0 ) # default attributes for this environment attributes( "apache2" => { "listen_ports" => ["80", "443"] } ) @gbagnoli Introduzione a Chef 12/09/2012 28 / 50
  • 62. Environments Environments can be used to manage diļ¬€erent environments (production, test, etc) in a single Chef setup. Roles can have diļ¬€erent run list on diļ¬€erent environments name "production" description "The production environment" cookbook_versions( "mysql" => "= 1.2.5", # use version 1.2.5 only "apache2" => "~> 1.1" # anything 1.1.0 < x < 1.2.0 ) # default attributes for this environment attributes( "apache2" => { "listen_ports" => ["80", "443"] } ) As with role, the ruby DSL gets compiled to JSON when uploading to server @gbagnoli Introduzione a Chef 12/09/2012 28 / 50
  • 63. Environments (2) $ knife environment list production $ knife environment show production -F json { "name": "production", "description": "The production environment", "cookbook_versions": { "mysql": "= 1.2.5", "apache2": "~> 1.1" }, "json_class": "Chef::Environment", "chef_type": "environment", "default_attributes": { "apache2": { "listen_ports": [ "80", "443" ] } }, "override_attributes": { } } @gbagnoli Introduzione a Chef 12/09/2012 29 / 50
  • 64. Environments (3) Cookbooks can be frozen, so that following uploads with the same version will fail. $ # -E automatically sets a requirement for the specified environment $ knife cookbook upload redis -- freeze -E production Uploading redis ... upload complete $ knife cookbook show redis 1.0.2 | grep " frozen " frozen ?: true $ knife cookbook upload redis Uploading redis ... ERROR : Version 1.0.2 of cookbook redis is frozen . Use -- force to override . ERROR : Failed to upload 1 cookbook . $ knife environment show production | grep redis users : = 1.0.2 @gbagnoli Introduzione a Chef 12/09/2012 30 / 50
  • 65. Data Bags Data bags provide an arbitrary store of globally available JSON data. @gbagnoli Introduzione a Chef 12/09/2012 31 / 50
  • 66. Data Bags Data bags provide an arbitrary store of globally available JSON data. Data bags can be encrypted (but then cannot be searched, except for id) @gbagnoli Introduzione a Chef 12/09/2012 31 / 50
  • 67. Data Bags (Encrypted) (warn: fake data ahead) $ knife data bag show accounts gbagnoli comment : tenoh > dieliSh ā€™ i7eexeijeiSh ^ u9phaeGhuu4chaa *= email : A h r 8 i s 3 a h C h o h m 6 a e n e i c ( aef " a h1e eree Voh hie 6Up = group : Waix8Pa # iniy # oh6eem$eij = groups : xa i7on g7a ihi u1n eH & ah3ier3Goh } rae7nik$einaeb = id : gbagnoli shadow : yi e@ja h0v e$g 2Ae Gh } ido6koobuew | aebeenaequeRo ( xaiYei8eizi + f 7 ohqu < i@enequ & oh7ef - ahdae8dia [ c h a h 7 e e 4 y i e $ N 4 E e B i c h e e 5 e i r o h2JaGhae ^ k 6a e ph o hj ah s h6 Ae j a ^ cheew } o ) i 0 w o 5 i e s i s h 3 d i g h i e w o h tohoh0eegho7eik = shell : aeshi2ohy , ai6ai h2Ahquu = ssh_keys : [.. cut ..] uid : thahvo2IGhoh3osho8Ees /a= username : poh5WiuZ2Er : it ! ee1ahf { u = @gbagnoli Introduzione a Chef 12/09/2012 32 / 50
  • 68. Data Bags (Decrypted) $ knife data bag show accounts gbagnoli -- secret - file ~/. chef / enc_db_secret comment : Giacomo Bagnoli email : g . bagnoli@asidev . com group : wheel groups : [ asidev , users ] id : gbagnoli organization : asidev shadow : $6$ [... cut ...] shell : / bin / bash ssh_keys : [" ssh - rsa [... cut ...] Giacomo Bagnoli "] uid : 3000 username : g . bagnoli @gbagnoli Introduzione a Chef 12/09/2012 33 / 50
  • 69. Anatomy of a Chef Run @gbagnoli Introduzione a Chef 12/09/2012 34 / 50
  • 70. Anatomy of a Chef Run ā€¢ chef-client starts @gbagnoli Introduzione a Chef 12/09/2012 34 / 50
  • 71. Anatomy of a Chef Run ā€¢ chef-client starts ā€¢ Builds node (runs ohai, perform deep-merge of attrs) @gbagnoli Introduzione a Chef 12/09/2012 34 / 50
  • 72. Anatomy of a Chef Run ā€¢ chef-client starts ā€¢ Builds node (runs ohai, perform deep-merge of attrs) ā€¢ chef-client registers with the server @gbagnoli Introduzione a Chef 12/09/2012 34 / 50
  • 73. Anatomy of a Chef Run ā€¢ chef-client starts ā€¢ Builds node (runs ohai, perform deep-merge of attrs) ā€¢ chef-client registers with the server ā€¢ Cookbook sync @gbagnoli Introduzione a Chef 12/09/2012 34 / 50
  • 74. Anatomy of a Chef Run ā€¢ chef-client starts ā€¢ Builds node (runs ohai, perform deep-merge of attrs) ā€¢ chef-client registers with the server ā€¢ Cookbook sync ā€¢ Compiles resource collection, loading: @gbagnoli Introduzione a Chef 12/09/2012 34 / 50
  • 75. Anatomy of a Chef Run ā€¢ chef-client starts ā€¢ Builds node (runs ohai, perform deep-merge of attrs) ā€¢ chef-client registers with the server ā€¢ Cookbook sync ā€¢ Compiles resource collection, loading: ā€¢ libraries @gbagnoli Introduzione a Chef 12/09/2012 34 / 50
  • 76. Anatomy of a Chef Run ā€¢ chef-client starts ā€¢ Builds node (runs ohai, perform deep-merge of attrs) ā€¢ chef-client registers with the server ā€¢ Cookbook sync ā€¢ Compiles resource collection, loading: ā€¢ libraries ā€¢ resources / deļ¬nitions @gbagnoli Introduzione a Chef 12/09/2012 34 / 50
  • 77. Anatomy of a Chef Run ā€¢ chef-client starts ā€¢ Builds node (runs ohai, perform deep-merge of attrs) ā€¢ chef-client registers with the server ā€¢ Cookbook sync ā€¢ Compiles resource collection, loading: ā€¢ libraries ā€¢ resources / deļ¬nitions ā€¢ attributes @gbagnoli Introduzione a Chef 12/09/2012 34 / 50
  • 78. Anatomy of a Chef Run ā€¢ chef-client starts ā€¢ Builds node (runs ohai, perform deep-merge of attrs) ā€¢ chef-client registers with the server ā€¢ Cookbook sync ā€¢ Compiles resource collection, loading: ā€¢ libraries ā€¢ resources / deļ¬nitions ā€¢ attributes ā€¢ recipes @gbagnoli Introduzione a Chef 12/09/2012 34 / 50
  • 79. Anatomy of a Chef Run ā€¢ chef-client starts ā€¢ Builds node (runs ohai, perform deep-merge of attrs) ā€¢ chef-client registers with the server ā€¢ Cookbook sync ā€¢ Compiles resource collection, loading: ā€¢ libraries ā€¢ resources / deļ¬nitions ā€¢ attributes ā€¢ recipes ā€¢ Executes - Conļ¬gure Node @gbagnoli Introduzione a Chef 12/09/2012 34 / 50
  • 80. Anatomy of a Chef Run ā€¢ chef-client starts ā€¢ Builds node (runs ohai, perform deep-merge of attrs) ā€¢ chef-client registers with the server ā€¢ Cookbook sync ā€¢ Compiles resource collection, loading: ā€¢ libraries ā€¢ resources / deļ¬nitions ā€¢ attributes ā€¢ recipes ā€¢ Executes - Conļ¬gure Node ā€¢ Converge: each resource is mapped to a provider and which takes action on it @gbagnoli Introduzione a Chef 12/09/2012 34 / 50
  • 81. Anatomy of a Chef Run ā€¢ chef-client starts ā€¢ Builds node (runs ohai, perform deep-merge of attrs) ā€¢ chef-client registers with the server ā€¢ Cookbook sync ā€¢ Compiles resource collection, loading: ā€¢ libraries ā€¢ resources / deļ¬nitions ā€¢ attributes ā€¢ recipes ā€¢ Executes - Conļ¬gure Node ā€¢ Converge: each resource is mapped to a provider and which takes action on it ā€¢ Saves Node @gbagnoli Introduzione a Chef 12/09/2012 34 / 50
  • 82. Anatomy of a Chef Run ā€¢ chef-client starts ā€¢ Builds node (runs ohai, perform deep-merge of attrs) ā€¢ chef-client registers with the server ā€¢ Cookbook sync ā€¢ Compiles resource collection, loading: ā€¢ libraries ā€¢ resources / deļ¬nitions ā€¢ attributes ā€¢ recipes ā€¢ Executes - Conļ¬gure Node ā€¢ Converge: each resource is mapped to a provider and which takes action on it ā€¢ Saves Node ā€¢ Runs notiļ¬cation Handlers On errors, exception handlers are run. @gbagnoli Introduzione a Chef 12/09/2012 34 / 50
  • 83. Chef development workļ¬‚ow @gbagnoli Introduzione a Chef 12/09/2012 35 / 50
  • 84. Chef development workļ¬‚ow ā€¢ Write cookbooks/recipe @gbagnoli Introduzione a Chef 12/09/2012 35 / 50
  • 85. Chef development workļ¬‚ow ā€¢ Write cookbooks/recipe ā€¢ Upload the modiļ¬ed cookbook to the chef server @gbagnoli Introduzione a Chef 12/09/2012 35 / 50
  • 86. Chef development workļ¬‚ow ā€¢ Write cookbooks/recipe ā€¢ Upload the modiļ¬ed cookbook to the chef server ā€¢ Add the cookbook to a run list (in a node or in a role) @gbagnoli Introduzione a Chef 12/09/2012 35 / 50
  • 87. Chef development workļ¬‚ow ā€¢ Write cookbooks/recipe ā€¢ Upload the modiļ¬ed cookbook to the chef server ā€¢ Add the cookbook to a run list (in a node or in a role) ā€¢ Wait for chef-client to run on nodes @gbagnoli Introduzione a Chef 12/09/2012 35 / 50
  • 88. Chef development workļ¬‚ow ā€¢ Write cookbooks/recipe ā€¢ Upload the modiļ¬ed cookbook to the chef server ā€¢ Add the cookbook to a run list (in a node or in a role) ā€¢ Wait for chef-client to run on nodes ā€¢ Commit changes in git @gbagnoli Introduzione a Chef 12/09/2012 35 / 50
  • 89. Search Full-text query engine based on Apache Solr. Searches can be performed from knife and in recipes. Almost any object is indexed by the chef server, like roles, nodes, api clients and environments. $ knife search node " recipes : apache2 " 7 items found ... $ knife search node " recipes : apache2 AND chef_environment : production " 5 items found ... $ knife search node " roles : lxc_guest " 9 items found ... $ knife search client " admin : true " 4 items found ... $ knife search role " name : lxc *" 2 items found ... @gbagnoli Introduzione a Chef 12/09/2012 36 / 50
  • 90. Bootstrapping Bootstrapping is installing chef on new nodes . . . using chef. First, create the node: $ knife node create mynewnode . example . com # .. fires up $EDITOR # .. set run_list / attributes / etc / environment @gbagnoli Introduzione a Chef 12/09/2012 37 / 50
  • 91. Bootstrapping Bootstrapping is installing chef on new nodes . . . using chef. First, create the node: $ knife node create mynewnode . example . com # .. fires up $EDITOR # .. set run_list / attributes / etc / environment Assuming that the new node is a bare ubuntu install, bootstrap the node $ knife boostrap -N mynewnode . example . com -d ubuntu $NODE_IP -- sudo -V -x ubuntu @gbagnoli Introduzione a Chef 12/09/2012 37 / 50
  • 92. Bootstrapping Bootstrapping is installing chef on new nodes . . . using chef. First, create the node: $ knife node create mynewnode . example . com # .. fires up $EDITOR # .. set run_list / attributes / etc / environment Assuming that the new node is a bare ubuntu install, bootstrap the node $ knife boostrap -N mynewnode . example . com -d ubuntu $NODE_IP -- sudo -V -x ubuntu Or, combine with provisioning (i.e. Amazon AWS) knife ec2 server create -I ami - db595faf -- flavor t1 . micro -- region eu - west -1 -G default -x ubuntu -N newnode . example . com -d ubuntu -Z eu - west -1 a Chef Omnibus bootstrap template @gbagnoli Introduzione a Chef 12/09/2012 37 / 50
  • 93. Monitoring: CheckMK and Chef @gbagnoli Introduzione a Chef 12/09/2012 38 / 50
  • 94. Monitoring We use CheckMK to conļ¬gure Icinga for monitoring our infrastructure. @gbagnoli Introduzione a Chef 12/09/2012 39 / 50
  • 95. Monitoring We use CheckMK to conļ¬gure Icinga for monitoring our infrastructure. CheckMK is a general purpose nagios plugin to retrive data from hosts. @gbagnoli Introduzione a Chef 12/09/2012 39 / 50
  • 96. Monitoring We use CheckMK to conļ¬gure Icinga for monitoring our infrastructure. CheckMK is a general purpose nagios plugin to retrive data from hosts. 1. One active check per host per check interval (calling check mk as a plugin). @gbagnoli Introduzione a Chef 12/09/2012 39 / 50
  • 97. Monitoring We use CheckMK to conļ¬gure Icinga for monitoring our infrastructure. CheckMK is a general purpose nagios plugin to retrive data from hosts. 1. One active check per host per check interval (calling check mk as a plugin). 2. The connection is done via TCP to the check mk agent on the target host @gbagnoli Introduzione a Chef 12/09/2012 39 / 50
  • 98. Monitoring We use CheckMK to conļ¬gure Icinga for monitoring our infrastructure. CheckMK is a general purpose nagios plugin to retrive data from hosts. 1. One active check per host per check interval (calling check mk as a plugin). 2. The connection is done via TCP to the check mk agent on the target host (All host data is sent back at once as ASCII text.) @gbagnoli Introduzione a Chef 12/09/2012 39 / 50
  • 99. Monitoring We use CheckMK to conļ¬gure Icinga for monitoring our infrastructure. CheckMK is a general purpose nagios plugin to retrive data from hosts. 1. One active check per host per check interval (calling check mk as a plugin). 2. The connection is done via TCP to the check mk agent on the target host (All host data is sent back at once as ASCII text.) 3. check mk extracts performance data. @gbagnoli Introduzione a Chef 12/09/2012 39 / 50
  • 100. Monitoring We use CheckMK to conļ¬gure Icinga for monitoring our infrastructure. CheckMK is a general purpose nagios plugin to retrive data from hosts. 1. One active check per host per check interval (calling check mk as a plugin). 2. The connection is done via TCP to the check mk agent on the target host (All host data is sent back at once as ASCII text.) 3. check mk extracts performance data. 4. check mk checks warn/crit thresholds and submits results to Icinga as passive checks. @gbagnoli Introduzione a Chef 12/09/2012 39 / 50
  • 101. Monitoring - Nodes On nodes, the check mk::agent recipe, included in all nodes via the base role, installs the check mk agent. @gbagnoli Introduzione a Chef 12/09/2012 40 / 50
  • 102. Monitoring - Nodes On nodes, the check mk::agent recipe, included in all nodes via the base role, installs the check mk agent. It also sets up xinetd and the ļ¬rewall so that connections to the agent are allowed only from the monitoring host(s). @gbagnoli Introduzione a Chef 12/09/2012 40 / 50
  • 103. Monitoring - Nodes On nodes, the check mk::agent recipe, included in all nodes via the base role, installs the check mk agent. It also sets up xinetd and the ļ¬rewall so that connections to the agent are allowed only from the monitoring host(s). Monitoring hosts are speciļ¬ed as attributes in the base role. @gbagnoli Introduzione a Chef 12/09/2012 40 / 50
  • 104. Monitoring - Nodes (2) (almost) Every cookbook pushes a MRPE or check mk plugin check to the node, so the check mk agent returns data for all conļ¬gured services. i.e. , in the mysql:: server recipe mrpe_check "mysql" do script "check_mysql" variables( :passwd => node["mysql"]["server_root_password"], :checks => checks, :tunables => node["mysql"]["tunable"] ) end @gbagnoli Introduzione a Chef 12/09/2012 41 / 50
  • 105. Monitoring - Nodes (2) (almost) Every cookbook pushes a MRPE or check mk plugin check to the node, so the check mk agent returns data for all conļ¬gured services. i.e. , in the mysql:: server recipe mrpe_check "mysql" do script "check_mysql" variables( :passwd => node["mysql"]["server_root_password"], :checks => checks, :tunables => node["mysql"]["tunable"] ) end > telnet mysql-server.example.com 6556 [...] <<<mrpe>>> (check_mysql) mysql_idx 0 OK - index usage 53.60% | index_usage=53.60%;0:;0: (check_mysql) mysql_running 0 OK - 0 long running processes | long_running_procs=0;10;20 (check_mysql) mysql_threads 0 OK - 18 client connection threads | threads_connected=18;80;95 [...] @gbagnoli Introduzione a Chef 12/09/2012 41 / 50
  • 106. Monitoring - Server On the server, the check mk:: server recipe installs and conļ¬gures icinga, nsca, nagvis, pnp4nagios smokeping and check mk. @gbagnoli Introduzione a Chef 12/09/2012 42 / 50
  • 107. Monitoring - Server On the server, the check mk:: server recipe installs and conļ¬gures icinga, nsca, nagvis, pnp4nagios smokeping and check mk. The check mk conļ¬guration ļ¬le (which is used by check mk to conļ¬gure active and passive checks in icinga) is managed as a template by the recipe. The recipe use the search API to discover nodes using a conļ¬gurable query. @gbagnoli Introduzione a Chef 12/09/2012 42 / 50
  • 108. Monitoring - Server On the server, the check mk:: server recipe installs and conļ¬gures icinga, nsca, nagvis, pnp4nagios smokeping and check mk. The check mk conļ¬guration ļ¬le (which is used by check mk to conļ¬gure active and passive checks in icinga) is managed as a template by the recipe. The recipe use the search API to discover nodes using a conļ¬gurable query. nodes = search(:node, node["check_mk"]["search_query"]) default query: default [ā€check mkā€][ā€search queryā€] = ā€chef environment:productionā€ @gbagnoli Introduzione a Chef 12/09/2012 42 / 50
  • 109. Monitoring - Server (2) So, when a node is promoted to production, as soon as chef runs on the monitoring server, @gbagnoli Introduzione a Chef 12/09/2012 43 / 50
  • 110. Monitoring - Server (2) So, when a node is promoted to production, as soon as chef runs on the monitoring server, ā€¢ It adds the node to the check mk conf ļ¬le (the template is the same, but data has changed) @gbagnoli Introduzione a Chef 12/09/2012 43 / 50
  • 111. Monitoring - Server (2) So, when a node is promoted to production, as soon as chef runs on the monitoring server, ā€¢ It adds the node to the check mk conf ļ¬le (the template is the same, but data has changed) ā€¢ . . . the modiļ¬ed templates notiļ¬es the check mk write conf resource, which is queued @gbagnoli Introduzione a Chef 12/09/2012 43 / 50
  • 112. Monitoring - Server (2) So, when a node is promoted to production, as soon as chef runs on the monitoring server, ā€¢ It adds the node to the check mk conf ļ¬le (the template is the same, but data has changed) ā€¢ . . . the modiļ¬ed templates notiļ¬es the check mk write conf resource, which is queued template "#{node[ā€™check_mkā€™][ā€™conf_dirā€™]}/main.mk" do source "check_mk_main.mk.erb" variables( :nodes => nodes, :hostgroups => hostgroups, :params => node[ā€™check_mkā€™][ā€™paramsā€™] ) mode 0644 owner "root" group "root" notifies :run, "execute[check_mk_write_conf]" end @gbagnoli Introduzione a Chef 12/09/2012 43 / 50
  • 113. Monitoring - Server (3) The check mk write conf resource regenerates icinga conf @gbagnoli Introduzione a Chef 12/09/2012 44 / 50
  • 114. Monitoring - Server (3) The check mk write conf resource regenerates icinga conf execute "check_mk_write_conf" do command "#{node[ā€™check_mkā€™][ā€™prefixā€™]}/bin/check_mk -O" action :nothing end @gbagnoli Introduzione a Chef 12/09/2012 44 / 50
  • 115. Monitoring - Server (3) The check mk write conf resource regenerates icinga conf execute "check_mk_write_conf" do command "#{node[ā€™check_mkā€™][ā€™prefixā€™]}/bin/check_mk -O" action :nothing end Then the recipe scan nodes for services (using check mk inventory) This is done only the ļ¬rst time (no reinventory) nodes.each do |n| if not n[ā€™tagsā€™] or not n[ā€™tagsā€™].include? "noagent" check_mk_inventory n[ā€™fqdnā€™] end end check mk inventory is an LWRP deļ¬ned in the check mk cookbook @gbagnoli Introduzione a Chef 12/09/2012 44 / 50
  • 116. Monitoring - Server (4) That way new nodes are automatically added to the monitoring when they show up as result of the search query. Since cookbooks push and conļ¬gure check mk plugins, everything gets monitored and all the monitoring logic is in the cookbook itself. @gbagnoli Introduzione a Chef 12/09/2012 45 / 50
  • 117. Monitoring Chef Clients Once you start relying on chef, you want to know if chef-client is correctly running on nodes and if/when it fails. @gbagnoli Introduzione a Chef 12/09/2012 46 / 50
  • 118. Monitoring Chef Clients Once you start relying on chef, you want to know if chef-client is correctly running on nodes and if/when it fails. Instead on relying on the active model of check mk, we use a completely passive approach. We use NSCA for this. @gbagnoli Introduzione a Chef 12/09/2012 46 / 50
  • 119. Monitoring Chef Clients Once you start relying on chef, you want to know if chef-client is correctly running on nodes and if/when it fails. Instead on relying on the active model of check mk, we use a completely passive approach. We use NSCA for this. When chef-client runs on the node, it pushes a report/exception handler called NSCAHandler. This handler runs at the end of a chef-client run, and submits the result to the NSCA server on the monitoring host, so that: @gbagnoli Introduzione a Chef 12/09/2012 46 / 50
  • 120. Monitoring Chef Clients Once you start relying on chef, you want to know if chef-client is correctly running on nodes and if/when it fails. Instead on relying on the active model of check mk, we use a completely passive approach. We use NSCA for this. When chef-client runs on the node, it pushes a report/exception handler called NSCAHandler. This handler runs at the end of a chef-client run, and submits the result to the NSCA server on the monitoring host, so that: ā€¢ check is in critical state if chef run failed. ā€¢ check is in warning/critical state if time elapsed is above thresholds ā€¢ check is in warning/critical state if the number of modiļ¬ed resources is above thresholds @gbagnoli Introduzione a Chef 12/09/2012 46 / 50
  • 121. Monitoring Chef Clients (2) Passive checks are created on the server for every node which runs the chef-client These checks have a freshness threshold of 1 day, so that if no data arrives from the node the check will enter the UNKOWN state, meaning the chef-client is not running on that node. @gbagnoli Introduzione a Chef 12/09/2012 47 / 50
  • 122. Monitoring - Final Words The check mk:: server recipe also conļ¬gures: ā€¢ host parents ā€¢ host groups ā€¢ service groups ā€¢ notiļ¬cation periods for services ā€¢ contact groups and administrators (data is in the accounts data bag) ā€¢ uses smokeping to perfom hosts checks (instead of using check ping) ā€¢ . . . and integrates smokeping web ui with check mk multisite. ā€¢ host icon for the status map :-) Behavior can be changed by setting nodes tag with knife. i.e, this changes the notiļ¬cation period for a host. knife tag create myhost.example.com workhours @gbagnoli Introduzione a Chef 12/09/2012 48 / 50
  • 124. Thank you! @gbagnoli Introduzione a Chef 12/09/2012 50 / 50