Slide 1

Slide 1 text

Chef The Open-Source Configuration Management Framework Tuesday, November 20, 12

Slide 2

Slide 2 text

Paul Welch System Administrator @ Squaremouth twitter: @pwelch github: @pwelch Tuesday, November 20, 12

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

Chef Cookbooks Tuesday, November 20, 12

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

Data Bags Tuesday, November 20, 12

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

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