Chef, Devops, and You Image from http://dev2ops.org/blog/2010/2/22/what-is-devops.html Bryan W. Berry, 18 November 2011
Who am I? Linux Geek for 7 years Python, Ruby coder Played with a lot of different configuration management tools and techniques
We need a new  way to work Infrastructure needs to be Repeatable Testable Scalable No Snowflakes!
Devops? Agile Development Practices applied to infrastructure New tooling to automate infrastructure Testing, testing, testing
Infrastructure as Code http://www.flickr.com/photos/wonderlane/2306082998/
Chef is . . . A library for Configuration Management A Configuration Management System A Systems Integration Platform An API for your entire infrastructure Open-source!
How Chef works Chef  Server PROD QA DEV Workstation VM Cookbooks Data Bags Attributes
DEV, QA, PROD Servers Supposed to have the same configuration Is this humanly possible  without Chef? I don’t think so PROD QA DEV == ==
Chef client runs on each Server They talk to the Chef Server Chef can also run without a server,  chef-solo
We call each system you configure a  Node
 
Attributes are Searchable $ knife search node ‘jdk_version:1.7’ # returns list of nodes with jdk 1.7 search(:node, ‘java_version:1.7’)
Nodes have  run_list “ run_list”: { “ recipe[java]”, “ recipe[jboss]”, “ role[internal]” }
Nodes have  Roles Roles describe what a  node should be
Roles are Searchable $ knife search role ‘max_children:50’ search(:role, ‘max_children:50’)
Roles have a run_list What  roles  or  recipes  to  apply in  order
Chef manages  resources   on nodes Resources are specified in  recipes,   recipes are stored in  cookbooks A node’s run_list specifies which recipes (and thus resources) are applied
 
Client / Server Chef  Server PROD QA DEV Nodes Nodes report their attributes to the  Chef-server with the  ‘ Node’ object attributes Chef Repository
Chef  Server PROD QA DEV Nodes Server applies roles and sends run_list, roles, and  all  cookbooks back to clients run_list, roles, cookbooks Chef Repository
Skinny Server, Fat Clients No “builds” are done on the server A Node configures itself based on  its run_list and the  downloaded cookbooks
Back to Recipes!
 
 
Ruby, baby! Chef configuration written in pure ruby Devops == Ruby If you also learn Ruby, it will be helpful but is not required If you are really curious why devops == Ruby, you read more here http://devopsanywhere.blogspot.com/2011/09/how-ruby-is-beating-python-in-battle.html
Cookbooks are packages  for Recipes
Cookbook Components Attributes Recipes Metadata Assets (files/templates)
Sharing is beautiful 200+ high-quality cookbooks on community.opscode.com and growing all the time Easy to customize existing cookbooks Chef’s real value is this collection of cookbooks
Data Bags Data Bags are arbitrary stores of globally available JSON data Think of them as global  variables/data sctructures  for your infrastructure
Data Bags have Items Data bag  users/john { "comment": “postgres Rul3z", "groups": [“"sysadmins", "postgres" ], "ssh_keys": "ssh-rsa …..", "id": “john", "shell": "/bin/bash" }
Data Bags are Searchable! pg_users = search(:users,  “groups:postgres”) group “postgres” do members pg_users end
Code/data Split Recipes Templates Attributes Data Bags Node Object Role Cookbook run_list Node Object Role Environments The fact that attributes are in cookbooks, roles, environments,  And the node itself can be confusing
tl;dr  How do I get Started? Do the Quick start using  hosted chef, free for 5 nodes  http://wiki.opscode.com/display/chef/Quick+Start You can use Ubuntu, Mac OS X, and maybe Windows
Possible Corporate Setup PROD-Chef  Server PROD QA DEV DEV-Chef  Server Bar Foo Dev Playground: Devs have full access To chef-server Disposable  nodes for testing cookbooks Only sysadmins Have chef access
Tools Chef web interface – Pretty! Ohai – collects information about node Knife – command-line tool Shef – interpreter for working with cookbooks git  - not part of chef, but hard to use chef without also using git
A Very Simple Recipe
This should look familiar
How we can use Chef Sysadmins write cookbooks and maintain chef-server Devs can also write cookbooks to help the sysadmin Store of configuration information Sysadmins will spend more time  managing configurations  and less time  managing individual servers
Questions? Bryan Berry  skype: berrdawg [email_address] Portions of this presentations were taken liberally from Joshua Timberman’s Chef 101 presentation Copyright Bryan W. Berry 2011 Creative Commons 3.0 Unported CC-BY-SA

Chef, Devops, and You

  • 1.
    Chef, Devops, andYou Image from http://dev2ops.org/blog/2010/2/22/what-is-devops.html Bryan W. Berry, 18 November 2011
  • 2.
    Who am I?Linux Geek for 7 years Python, Ruby coder Played with a lot of different configuration management tools and techniques
  • 3.
    We need anew way to work Infrastructure needs to be Repeatable Testable Scalable No Snowflakes!
  • 4.
    Devops? Agile DevelopmentPractices applied to infrastructure New tooling to automate infrastructure Testing, testing, testing
  • 5.
    Infrastructure as Codehttp://www.flickr.com/photos/wonderlane/2306082998/
  • 6.
    Chef is .. . A library for Configuration Management A Configuration Management System A Systems Integration Platform An API for your entire infrastructure Open-source!
  • 7.
    How Chef worksChef Server PROD QA DEV Workstation VM Cookbooks Data Bags Attributes
  • 8.
    DEV, QA, PRODServers Supposed to have the same configuration Is this humanly possible without Chef? I don’t think so PROD QA DEV == ==
  • 9.
    Chef client runson each Server They talk to the Chef Server Chef can also run without a server, chef-solo
  • 10.
    We call eachsystem you configure a Node
  • 11.
  • 12.
    Attributes are Searchable$ knife search node ‘jdk_version:1.7’ # returns list of nodes with jdk 1.7 search(:node, ‘java_version:1.7’)
  • 13.
    Nodes have run_list “ run_list”: { “ recipe[java]”, “ recipe[jboss]”, “ role[internal]” }
  • 14.
    Nodes have Roles Roles describe what a node should be
  • 15.
    Roles are Searchable$ knife search role ‘max_children:50’ search(:role, ‘max_children:50’)
  • 16.
    Roles have arun_list What roles or recipes to apply in order
  • 17.
    Chef manages resources on nodes Resources are specified in recipes, recipes are stored in cookbooks A node’s run_list specifies which recipes (and thus resources) are applied
  • 18.
  • 19.
    Client / ServerChef Server PROD QA DEV Nodes Nodes report their attributes to the Chef-server with the ‘ Node’ object attributes Chef Repository
  • 20.
    Chef ServerPROD QA DEV Nodes Server applies roles and sends run_list, roles, and all cookbooks back to clients run_list, roles, cookbooks Chef Repository
  • 21.
    Skinny Server, FatClients No “builds” are done on the server A Node configures itself based on its run_list and the downloaded cookbooks
  • 22.
  • 23.
  • 24.
  • 25.
    Ruby, baby! Chefconfiguration written in pure ruby Devops == Ruby If you also learn Ruby, it will be helpful but is not required If you are really curious why devops == Ruby, you read more here http://devopsanywhere.blogspot.com/2011/09/how-ruby-is-beating-python-in-battle.html
  • 26.
  • 27.
    Cookbook Components AttributesRecipes Metadata Assets (files/templates)
  • 28.
    Sharing is beautiful200+ high-quality cookbooks on community.opscode.com and growing all the time Easy to customize existing cookbooks Chef’s real value is this collection of cookbooks
  • 29.
    Data Bags DataBags are arbitrary stores of globally available JSON data Think of them as global variables/data sctructures for your infrastructure
  • 30.
    Data Bags haveItems Data bag users/john { "comment": “postgres Rul3z", "groups": [“"sysadmins", "postgres" ], "ssh_keys": "ssh-rsa …..", "id": “john", "shell": "/bin/bash" }
  • 31.
    Data Bags areSearchable! pg_users = search(:users, “groups:postgres”) group “postgres” do members pg_users end
  • 32.
    Code/data Split RecipesTemplates Attributes Data Bags Node Object Role Cookbook run_list Node Object Role Environments The fact that attributes are in cookbooks, roles, environments, And the node itself can be confusing
  • 33.
    tl;dr Howdo I get Started? Do the Quick start using hosted chef, free for 5 nodes http://wiki.opscode.com/display/chef/Quick+Start You can use Ubuntu, Mac OS X, and maybe Windows
  • 34.
    Possible Corporate SetupPROD-Chef Server PROD QA DEV DEV-Chef Server Bar Foo Dev Playground: Devs have full access To chef-server Disposable nodes for testing cookbooks Only sysadmins Have chef access
  • 35.
    Tools Chef webinterface – Pretty! Ohai – collects information about node Knife – command-line tool Shef – interpreter for working with cookbooks git - not part of chef, but hard to use chef without also using git
  • 36.
  • 37.
  • 38.
    How we canuse Chef Sysadmins write cookbooks and maintain chef-server Devs can also write cookbooks to help the sysadmin Store of configuration information Sysadmins will spend more time managing configurations and less time managing individual servers
  • 39.
    Questions? Bryan Berry skype: berrdawg [email_address] Portions of this presentations were taken liberally from Joshua Timberman’s Chef 101 presentation Copyright Bryan W. Berry 2011 Creative Commons 3.0 Unported CC-BY-SA