Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Chef Overview

Paul Welch
November 15, 2012

Chef Overview

Overview of the Chef Configuration Management Framework

Paul Welch

November 15, 2012
Tweet

Other Decks in Programming

Transcript

  1. Configuration Management Better Described as Infrastructure as Code “ Enable

    reconstruction of the business from nothing but a source code repository, an application data backup, and bare metal resources “ - Jesse Robbins, Opscode Tuesday, November 20, 12
  2. Chef Chef is Declarative: Describe what the infrastructure should be

    like, not how. Chef is Idempotent: Running recipes again should converge system back without failing. Chef is Convergent: Any changes will be returned to the state defined in Chef. Tuesday, November 20, 12
  3. Chef Architecture Chef Client: - Chef Client - Chef Solo

    Chef Server - Hosted Chef - Private Chef - Open Source Chef Server - Knife - Ohai - Shef (Chef Console) Tuesday, November 20, 12
  4. Resources and Providers Resources: Basic units of work in Chef.

    Packages can be installed via apt or yum but the package resource abstracts this. Providers: Providers allow Chef to support multiple platforms with a single Resource. package “tar” do action :install end Debian, Ubuntu: Chef::Provider::Package::Apt Redhat, Centos: Chef::Provider::Package::Yum Tuesday, November 20, 12
  5. Attributes Data values such as IP, hostname, cpu type There

    are four types of attributes in order of precedence (highest to lowest): - automatic - override - normal - default Attributes can be set on: - cookbooks - environments - roles - nodes Tuesday, November 20, 12
  6. Chef Terminology Nodes: - Any computer managed with Chef Roles:

    - Applied to nodes - Define a run list and role attributes role/web_server run_list: recipe[apache2], recipe[rails] attributes: “apache2” => { “port” => 8080” } Tuesday, November 20, 12
  7. Chef Terminology Data bags: - Provide an arbitrary store of

    globally accessible data Environments: - Provide a way to manage different environments (production, staging, dev) - Lock cookbook versions by environment - Can specify run lists and attributes environment/production name “production” run_list: role[base] cookbook_version({ “my_rails_app” => “=1.2.0” }) attributes: “rails” => { “port” => “4000” } Tuesday, November 20, 12
  8. Chef Terminology Search: - Search is a feature of Chef

    Server that allows you to query information about your infrastructure. - Chef indexes: Roles, Nodes, API Clients and Environments Search Examples: - knife search admins ‘username:root’ - knife search node ‘name:app*’ - knife search node role:web_server - knife search node “role:database AND chef_environment:production” knife ssh ‘role:web_server AND chef_environment:production’ uptime Tuesday, November 20, 12
  9. Chef Production - Servers are disposable. - Single repository for

    chef resources. - Use role attributes to override cookbooks. - Use environments to lock cookbook versions. - Create cookbooks that inherit from community cookbooks. - Store any static data in data bags. - Not just for servers. Deploying workstations should be easy. Tuesday, November 20, 12
  10. Chef Community Chef Community Cookbooks - http://community.opscode.com/ Food Fight (Chef

    Podcast) - http://foodfightshow.org/ Chef Documentation - http://docs.opscode.com/ Opscode Tickets - http://tickets.opscode.com/secure/Dashboard.jspa Opscode IRC - #chef and #chef-hacking on irc.freenode.com Tuesday, November 20, 12
  11. References Chef Fundamentals - https://github.com/opscode/chef-fundamentals Chef Documentation - http://docs.opscode.com/ Nagios

    Quick Start Demo - https://github.com/opscode/nagios-quick-start Infrastructure as Code - Adam Jacob Velocity 2012 http://www.youtube.com/watch?v=LKENuz-DKTg Capistrano Chef - https://github.com/cramerdev/capistrano-chef Pivotal Workstation - https://github.com/pivotal/pivotal_workstation Puppet Configuration Management - http://puppetlabs.com/ Learning Puppet - http://docs.puppetlabs.com/learning/index.html * images from Opscode Tuesday, November 20, 12