SlideShare a Scribd company logo
Introduction to Chef
SCALE Build a Cloud Day


     matt@opscode.com
     www.opscode.com
         @mattray
Congratulations!!!




       • U has a cloud
       • Now what?


      http://www.flickr.com/photos/ian_munroe/4758240536/
SCALE 10x Build a Cloud Day
APIs are awesome!


• You can provision
  compute resources in
  seconds
• You can provision
  storage resources in
  seconds
• That’s cool.

           http://www.flickr.com/photos/jdhancock/3634246981/
Chef can help with that
• knife ec2 server                            • knife cloudstack
        create                                  server create
• knife rackspace                             • knife kvm server
        server create                           create
• knife terremark                             • knife vsphere
        server create                           server create
• knife voxel                                 • knife eucalyptus
        server create                           server create
• knife gandi                                 • knife openstack
        server create                           server create
http://www.flickr.com/photos/kyz/3122499444/
But then what?




http://www.flickr.com/photos/doctorow/2698336843
You need to configure them
See Node


Application Server
See Nodes


Application Server


Application Database
See Nodes Grow


Application Server


Application Databases
See Nodes Grow


Application Servers


Application Databases
See Nodes Grow
Load Balancer


Application Servers


Application Databases
See Nodes Grow
Load Balancers


        Application Servers


Application Databases
See Nodes Grow
Load Balancers


        Application Servers


Application Database Cache


Application Databases
Tied together with Config
 Load Balancers


         Application Servers


 Application Database Cache


 Application Databases
Infrastructure is a Snowflake
   Load Balancers


            Application Servers


   Application Database Cache


   Floating IP?


   Application Databases
Evolving Complexity

        Load Balancers
              ApplicationCache

                   Application Servers
NoSQL        Database Cache

             Database Slaves

        Database
Complexity Grows Quickly
        DC2


DC1

                   DC3
And it Continues to Evolve




              http://www.flickr.com/photos/16339684@N00/2681435235/
Golden Images are not the answer


•   Gold is heavy
•   Hard to transport
•   Hard to mold
•   Easy to lose
    configuration detail


             http://www.flickr.com/photos/garysoup/2977173063/
Typical Boring Infrastructure

Graphite     Nagios


                               Jboss App


             Memcache

             Postgres Slaves


             Postgres Master
New Compliance Mandate

                         Graphite    Nagios


                                                       Jboss App

• Move SSH off port 22
• Lets put it on 2022                Memcache

                                     Postgres Slaves


                                     Postgres Master
6 Golden Image Updates

                       Graphite     1   2   Nagios


                              3                               Jboss App

• edit /etc/ssh/sshd_config         4       Memcache

                                    5       Postgres Slaves


                                        6   Postgres Master
12 Instance Replacements

                       Graphite   1    2    Nagios


                             3    4    5       6       7      Jboss App
• Delete, launch         8
• Repeat                               9    Memcache
• Typically manually
                                  10   11   Postgres Slaves


                                       12   Postgres Master
In a Maintenance Window

                          Graphite   1    2    Nagios


                              3      4    5       6       7      Jboss App

• Don't break anything!              8    9    Memcache

                                      5
                                     10   11   Postgres Slaves


                                          12   Postgres Master
With Different IP Addresses?

                          Graphite     Nagios


                                                         Jboss App

• Invalid Configs
• Bob just got fired :(               Memcache

                                       Postgres Slaves


                                       Postgres Master
Configuration Desperation




                 http://www.flickr.com/photos/francoforeshock/5716969942/
Configuration Management and
Automated Systems Integration
        is the Answer


                 http://www.flickr.com/photos/philliecasablanca/3354734116/
Chef Solves This Problem




           • But you already
             guessed that, didn’t
             you?
Collections of Resources
• Networking                                        • Routes
                                                    • Users
• Files                                             • Groups
• Directories                                       • Tasks
• Symlinks                                          • Packages
• Mounts                                            • Software
                                                    • Services
                                                    • Configurations
                                                    • Other Stuff
        http://www.flickr.com/photos/stevekeys/3123167585/
Acting in Concert




      http://www.flickr.com/photos/glowjangles/4081048126/
To Provide a Service




        http://www.flickr.com/photos/28309157@N08/3743455858/
Chef is Infrastructure as Code


             •     Programmatically
                   provision and configure
             •     Treat like any other code
                   base
             •     Reconstruct business from
                   code repository, data
                   backup, and bare metal
                   resources.


            http://www.flickr.com/photos/louisb/4555295187/
Declarative Interface to Resources



•    Define policy
•    Say what, not how
•    Pull not Push




http://www.flickr.com/photos/bixentro/2591838509/
That looks like this

extra_packages = case node['platform']
  when "ubuntu","debian"
    %w{
      ruby1.8
      ruby1.8-dev
      rdoc1.8
      ri1.8
      libopenssl-ruby
    }
  end
extra_packages.each do |pkg|
  package pkg do
    action :install
  end
end
Or this
search(:users, '*:*') do |u|
  user u['id'] do
      uid u['uid']
      shell u['shell']
      home "/home/#{u['id']}"
  end
  directory "#{home_dir}/.ssh" do
      owner u['id']
      group u['gid']
      mode "0700"
  end
  template "#{home_dir}/.ssh/authorized_keys" do
      source "authorized_keys.erb"
      owner u['id']
      group u['id']
      mode "0600"
      variables :ssh_keys => u['ssh_keys']
  end
end
Recipes and Cookbooks

•   Recipes are collections of
    Resources
•   Cookbooks contain
    recipes, templates, files,
    custom resources, etc
•   Code re-use and
    modularity
•   Hundreds already on
    Community.opscode.com

         http://www.flickr.com/photos/shutterhacks/4474421855/
Nodes
  • Chef-Client generates
       configurations directly
       on nodes
  • Reduce management
       complexity through
       abstraction
  • Store the configuration
       of your programs in
       version control


http://www.flickr.com/photos/ssoosay/5126146763/
Upload your infrastructure
knife cookbook upload apt
knife cookbook upload chef-client
knife cookbook upload java
knife cookbook upload jpackage
knife cookbook upload ntp
knife cookbook upload sudo
knife cookbook upload tomcat
knife cookbook upload users
knife cookbook upload sample
knife role from file base-cloud.rb
knife role from file tc.rb
knife role from file sample.rb
knife data bag create users
knife data bag from file users mray.json
Build it somewhere
#EC2
knife ec2 server create -S mray -i ~/.ssh/mray.pem -x ubuntu -G default -I ami-a7a97dce
-f m1.small -d omnibus -r 'role[base-cloud],role[tc],role[sample]'
#Rackspace
knife rackspace server create --image 110 --flavor 2 -i ~/.ssh/mray.pem -d omnibus -r
'role[base-cloud],role[tc],role[sample]'
#CloudStack
knife cs server create -S "small instance" -T "CentOS 5.5(64-bit) no GUI (KVM)" -i
~/.ssh/mray.pem -d omnibus -r 'role[base-cloud],role[tc],role[sample]'
#Ubuntu Linux
knife bootstrap test.lab -r 'role[webserver]' -i ~/.ssh/mray.pem -x ubuntu --sudo -d
omnibus -r 'role[base-cloud],role[tc],role[sample]'
Search

•   Search for nodes
    with Roles
•   Find configuration
    data

•   IP addresses
•   Hostnames
•   FQDNs




       http://www.flickr.com/photos/kathycsus/2686772625
Pass results into Templates

pool_members = search("node","role:webserver”)

template "/etc/haproxy/haproxy.cfg" do
  source "haproxy-app_lb.cfg.erb"
  owner "root"
  group "root"
  mode 0644
  variables :pool_members => pool_members.uniq
  notifies :restart, "service[haproxy]"
end
Pass results into Templates


# Set up application listeners here.
listen application 0.0.0.0:80
  balance roundrobin
  <% @pool_members.each do |member| -%>
  server <%= member[:hostname] %> <%= member[:ipaddress] %>:> weight 1 maxconn 1 check
  <% end -%>
<% if node["haproxy"]["enable_admin"] -%>
listen admin 0.0.0.0:22002
  mode http
  stats uri /
<% end -%>
So when this
Graphite   Nagios


                             Jboss App


           Memcache

           Postgres Slaves


           Postgres Master
Becomes this
Graphite   Nagios


                             Jboss App


           Memcache

           Postgres Slaves


           Postgres Master
Updates can be automatic
Graphite         Nagios


                                   Jboss App


                 Memcache

                 Postgres Slaves


                 Postgres Master
Count the resources
                                               •   Load balancer config
              Graphite              Nagios     •   Nagios host ping
                                               •   Nagios host ssh
                             Jboss App         •   Nagios host HTTP
                                               •   Nagios host app health
                             Memcache          •   Graphite CPU
                                               •   Graphite Memory
                             Postgres Slaves   •   Graphite Disk
                                               •   Graphite SNMP
                                               •   Memcache firewall
• 12+ resource changes for 1 node addition     •   Postgres firewall
                                                   Postgres authZ config
CLONING CANNOT COPE WITH THIS




                              •       Chef can.




                    http://www.flickr.com/photos/evelynishere/2798236471/
Build anything
       • Simple internal applications
       • Complex external applications
       • Workstations
       • Hadoop clusters
       • IaaS infrastructure
       • PaaS infrastructure
       • SaaS applications
       • Storage systems
       • You name it
http://www.flickr.com/photos/hyku/245010680/
And manage it simply
• Automatically
  reconfigure
  everything
• Linux, Windows,
  Unixes, BSDs
• Load balancers
• Metrics collection
  systems
• Monitoring systems
• Cloud migrations
  become trivial
                       http://www.flickr.com/photos/helico/404640681/
The Chef Community


•   Apache License, Version 2.0
•   550+ Individual contributors
•   100+ Corporate contributors
    •   Dell, Rackspace,VMware, RightScale,
        Heroku, and many more
•   Nearly 400 cookbooks
•   http://community.opscode.com
Questions?


  http://www.flickr.com/photos/mrchippy/443960682/
Thanks!


    matt@opscode.com
    www.opscode.com

More Related Content

PDF
Opscode-Eucalyptus Webinar 20110721
PDF
Rebooting a Cloud
PDF
Lessons from Etsy: Avoiding Kitchen Nightmares - #ChefConf 2012
PDF
Achieving Infrastructure Portability with Chef
PDF
Chef for OpenStack - OpenStack Fall 2012 Summit
KEY
Michelin Starred Cooking with Chef
PDF
Puppet Release Workflows at Jive Software
PPTX
Automated Deployments with Ansible
Opscode-Eucalyptus Webinar 20110721
Rebooting a Cloud
Lessons from Etsy: Avoiding Kitchen Nightmares - #ChefConf 2012
Achieving Infrastructure Portability with Chef
Chef for OpenStack - OpenStack Fall 2012 Summit
Michelin Starred Cooking with Chef
Puppet Release Workflows at Jive Software
Automated Deployments with Ansible

What's hot (20)

PPTX
Opscode Webinar: Managing Your VMware Infrastructure with Chef
PPTX
Chef Actions: Delightful near real-time activity tracking!
PDF
Play Framework: Intro & High-Level Overview
PDF
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
PDF
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
PDF
TXLF: Chef- Software Defined Infrastructure Today & Tomorrow
PDF
Chef Fundamentals Training Series Module 2: Workstation Setup
PDF
Velocity2011 chef-workshop
PDF
Chef Fundamentals Training Series Module 1: Overview of Chef
KEY
Using Nagios with Chef
ODP
Configuration Management and Salt
PDF
Environments - Fundamentals Webinar Series Week 5
PDF
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
PDF
Automating your infrastructure with Chef
PDF
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
PDF
AWS Developer Fundamentals
PPTX
Chef vs Puppet vs Ansible vs Saltstack | Configuration Management Tools | Dev...
PDF
Overview of Chef - Fundamentals Webinar Series Part 1
PPTX
Network Automation Tools
PPTX
Continuous Development with Jenkins - Stephen Connolly at PuppetCamp Dublin '12
Opscode Webinar: Managing Your VMware Infrastructure with Chef
Chef Actions: Delightful near real-time activity tracking!
Play Framework: Intro & High-Level Overview
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
TXLF: Chef- Software Defined Infrastructure Today & Tomorrow
Chef Fundamentals Training Series Module 2: Workstation Setup
Velocity2011 chef-workshop
Chef Fundamentals Training Series Module 1: Overview of Chef
Using Nagios with Chef
Configuration Management and Salt
Environments - Fundamentals Webinar Series Week 5
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
Automating your infrastructure with Chef
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
AWS Developer Fundamentals
Chef vs Puppet vs Ansible vs Saltstack | Configuration Management Tools | Dev...
Overview of Chef - Fundamentals Webinar Series Part 1
Network Automation Tools
Continuous Development with Jenkins - Stephen Connolly at PuppetCamp Dublin '12
Ad

Viewers also liked (8)

PDF
Welcome to the IT Industrial Revolution! Are you ready?
PDF
Creating a culture for Continuous Delivery
PDF
Who Says Elephants Can’t Cook? How IBM and Opscode are changing the role of c...
PPT
Transmedia Project Development
PDF
Cookbook refactoring & abstracting logic to Ruby(gems)
PDF
Exploiting Conway’s Law for Underpants and Profit
PDF
Mundo Digital.
PDF
Infrastructure as Codeの取り組みと改善
Welcome to the IT Industrial Revolution! Are you ready?
Creating a culture for Continuous Delivery
Who Says Elephants Can’t Cook? How IBM and Opscode are changing the role of c...
Transmedia Project Development
Cookbook refactoring & abstracting logic to Ruby(gems)
Exploiting Conway’s Law for Underpants and Profit
Mundo Digital.
Infrastructure as Codeの取り組みと改善
Ad

Similar to SCALE 10x Build a Cloud Day (20)

PDF
OpenStack Deployments with Chef
PDF
Chef for OpenStack- Fall 2012.pdf
PDF
Australian OpenStack User Group August 2012: Chef for OpenStack
KEY
Novalug 07142012
PDF
Infrastructure as code
PDF
Chef - Configuration Management for the Cloud
KEY
Software architectures for the cloud
PDF
Running your Java EE 6 applications in the Cloud (FISL 12)
PPTX
Protect your app from Outages
PPTX
19th February 2013, AWS User Group UK, Meetup #3, Managing your apps on AWS: ...
PDF
A Tale of a Server Architecture (Frozen Rails 2012)
PDF
The Automation Factory
PPTX
vBACD - Crash Course in Open Source Cloud Computing - 2/28
PDF
Cloud Best Practices
PPTX
Cloud Foundry Open Tour - London
KEY
Chef meetup presentation
PPTX
A Groovy Kind of Java (San Francisco Java User Group)
PDF
OSDC 2013 | Introduction into Chef by Andy Hawkins
PDF
JavaOne India 2011 - Running your Java EE 6 Apps in the Cloud
PDF
Running your Java EE 6 Apps in the Cloud - JavaOne India 2011
OpenStack Deployments with Chef
Chef for OpenStack- Fall 2012.pdf
Australian OpenStack User Group August 2012: Chef for OpenStack
Novalug 07142012
Infrastructure as code
Chef - Configuration Management for the Cloud
Software architectures for the cloud
Running your Java EE 6 applications in the Cloud (FISL 12)
Protect your app from Outages
19th February 2013, AWS User Group UK, Meetup #3, Managing your apps on AWS: ...
A Tale of a Server Architecture (Frozen Rails 2012)
The Automation Factory
vBACD - Crash Course in Open Source Cloud Computing - 2/28
Cloud Best Practices
Cloud Foundry Open Tour - London
Chef meetup presentation
A Groovy Kind of Java (San Francisco Java User Group)
OSDC 2013 | Introduction into Chef by Andy Hawkins
JavaOne India 2011 - Running your Java EE 6 Apps in the Cloud
Running your Java EE 6 Apps in the Cloud - JavaOne India 2011

More from Chef Software, Inc. (20)

PDF
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
PPTX
Opscode Webinar: Cooking with Chef on Microsoft Windows
PDF
Opscode tech festa july 2013
PPTX
Opscode Webinar: Automation for Education May 08-2013
PDF
Utility HPC: Right Systems, Right Scale, Right Science
PDF
The Berkshelf Way
PDF
Using Kanban and Chef: A Case Study – Jeffrey Hulten
PDF
SDN, Network Virtualization and the Software Defined Data Center – Brad Hedlund
PDF
ChefConf 2013 Keynote Session – Opscode – Adam Jacob
PDF
Using Chef and AppFirst to Automate Scale-out/Scale-down of Web Applications ...
PDF
The InstallShield of the 21st Century – Theo Schlossnagle
PDF
Chef ignited a DevOps revolution – BK Box
PDF
The unintended benefits of Chef
PDF
Push jobs: an orchestration building block for private Chef
PDF
Multi-provider Vagrant and Chef: AWS, VMware, and more
PDF
Growing Pains with Chef – a Tale of DevOps in a Large Organization
PDF
Cookin’ up Hybrid Clouds: Chef and the Accenture Cloud Platform
PDF
Configuration management and #monitoringlove
PDF
Working with Chef on Windows and Windows Azure
PDF
Tips and Tricks for Automating Windows with Chef
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
Opscode Webinar: Cooking with Chef on Microsoft Windows
Opscode tech festa july 2013
Opscode Webinar: Automation for Education May 08-2013
Utility HPC: Right Systems, Right Scale, Right Science
The Berkshelf Way
Using Kanban and Chef: A Case Study – Jeffrey Hulten
SDN, Network Virtualization and the Software Defined Data Center – Brad Hedlund
ChefConf 2013 Keynote Session – Opscode – Adam Jacob
Using Chef and AppFirst to Automate Scale-out/Scale-down of Web Applications ...
The InstallShield of the 21st Century – Theo Schlossnagle
Chef ignited a DevOps revolution – BK Box
The unintended benefits of Chef
Push jobs: an orchestration building block for private Chef
Multi-provider Vagrant and Chef: AWS, VMware, and more
Growing Pains with Chef – a Tale of DevOps in a Large Organization
Cookin’ up Hybrid Clouds: Chef and the Accenture Cloud Platform
Configuration management and #monitoringlove
Working with Chef on Windows and Windows Azure
Tips and Tricks for Automating Windows with Chef

Recently uploaded (20)

PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Spectroscopy.pptx food analysis technology
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
cuic standard and advanced reporting.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Big Data Technologies - Introduction.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Programs and apps: productivity, graphics, security and other tools
MIND Revenue Release Quarter 2 2025 Press Release
Diabetes mellitus diagnosis method based random forest with bat algorithm
Spectral efficient network and resource selection model in 5G networks
Building Integrated photovoltaic BIPV_UPV.pdf
Spectroscopy.pptx food analysis technology
MYSQL Presentation for SQL database connectivity
Dropbox Q2 2025 Financial Results & Investor Presentation
cuic standard and advanced reporting.pdf
The AUB Centre for AI in Media Proposal.docx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Electronic commerce courselecture one. Pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Big Data Technologies - Introduction.pptx

SCALE 10x Build a Cloud Day

  • 1. Introduction to Chef SCALE Build a Cloud Day matt@opscode.com www.opscode.com @mattray
  • 2. Congratulations!!! • U has a cloud • Now what? http://www.flickr.com/photos/ian_munroe/4758240536/
  • 4. APIs are awesome! • You can provision compute resources in seconds • You can provision storage resources in seconds • That’s cool. http://www.flickr.com/photos/jdhancock/3634246981/
  • 5. Chef can help with that • knife ec2 server • knife cloudstack create server create • knife rackspace • knife kvm server server create create • knife terremark • knife vsphere server create server create • knife voxel • knife eucalyptus server create server create • knife gandi • knife openstack server create server create http://www.flickr.com/photos/kyz/3122499444/
  • 7. You need to configure them
  • 10. See Nodes Grow Application Server Application Databases
  • 11. See Nodes Grow Application Servers Application Databases
  • 12. See Nodes Grow Load Balancer Application Servers Application Databases
  • 13. See Nodes Grow Load Balancers Application Servers Application Databases
  • 14. See Nodes Grow Load Balancers Application Servers Application Database Cache Application Databases
  • 15. Tied together with Config Load Balancers Application Servers Application Database Cache Application Databases
  • 16. Infrastructure is a Snowflake Load Balancers Application Servers Application Database Cache Floating IP? Application Databases
  • 17. Evolving Complexity Load Balancers ApplicationCache Application Servers NoSQL Database Cache Database Slaves Database
  • 19. And it Continues to Evolve http://www.flickr.com/photos/16339684@N00/2681435235/
  • 20. Golden Images are not the answer • Gold is heavy • Hard to transport • Hard to mold • Easy to lose configuration detail http://www.flickr.com/photos/garysoup/2977173063/
  • 21. Typical Boring Infrastructure Graphite Nagios Jboss App Memcache Postgres Slaves Postgres Master
  • 22. New Compliance Mandate Graphite Nagios Jboss App • Move SSH off port 22 • Lets put it on 2022 Memcache Postgres Slaves Postgres Master
  • 23. 6 Golden Image Updates Graphite 1 2 Nagios 3 Jboss App • edit /etc/ssh/sshd_config 4 Memcache 5 Postgres Slaves 6 Postgres Master
  • 24. 12 Instance Replacements Graphite 1 2 Nagios 3 4 5 6 7 Jboss App • Delete, launch 8 • Repeat 9 Memcache • Typically manually 10 11 Postgres Slaves 12 Postgres Master
  • 25. In a Maintenance Window Graphite 1 2 Nagios 3 4 5 6 7 Jboss App • Don't break anything! 8 9 Memcache 5 10 11 Postgres Slaves 12 Postgres Master
  • 26. With Different IP Addresses? Graphite Nagios Jboss App • Invalid Configs • Bob just got fired :( Memcache Postgres Slaves Postgres Master
  • 27. Configuration Desperation http://www.flickr.com/photos/francoforeshock/5716969942/
  • 28. Configuration Management and Automated Systems Integration is the Answer http://www.flickr.com/photos/philliecasablanca/3354734116/
  • 29. Chef Solves This Problem • But you already guessed that, didn’t you?
  • 30. Collections of Resources • Networking • Routes • Users • Files • Groups • Directories • Tasks • Symlinks • Packages • Mounts • Software • Services • Configurations • Other Stuff http://www.flickr.com/photos/stevekeys/3123167585/
  • 31. Acting in Concert http://www.flickr.com/photos/glowjangles/4081048126/
  • 32. To Provide a Service http://www.flickr.com/photos/28309157@N08/3743455858/
  • 33. Chef is Infrastructure as Code • Programmatically provision and configure • Treat like any other code base • Reconstruct business from code repository, data backup, and bare metal resources. http://www.flickr.com/photos/louisb/4555295187/
  • 34. Declarative Interface to Resources • Define policy • Say what, not how • Pull not Push http://www.flickr.com/photos/bixentro/2591838509/
  • 35. That looks like this extra_packages = case node['platform'] when "ubuntu","debian" %w{ ruby1.8 ruby1.8-dev rdoc1.8 ri1.8 libopenssl-ruby } end extra_packages.each do |pkg| package pkg do action :install end end
  • 36. Or this search(:users, '*:*') do |u| user u['id'] do uid u['uid'] shell u['shell'] home "/home/#{u['id']}" end directory "#{home_dir}/.ssh" do owner u['id'] group u['gid'] mode "0700" end template "#{home_dir}/.ssh/authorized_keys" do source "authorized_keys.erb" owner u['id'] group u['id'] mode "0600" variables :ssh_keys => u['ssh_keys'] end end
  • 37. Recipes and Cookbooks • Recipes are collections of Resources • Cookbooks contain recipes, templates, files, custom resources, etc • Code re-use and modularity • Hundreds already on Community.opscode.com http://www.flickr.com/photos/shutterhacks/4474421855/
  • 38. Nodes • Chef-Client generates configurations directly on nodes • Reduce management complexity through abstraction • Store the configuration of your programs in version control http://www.flickr.com/photos/ssoosay/5126146763/
  • 39. Upload your infrastructure knife cookbook upload apt knife cookbook upload chef-client knife cookbook upload java knife cookbook upload jpackage knife cookbook upload ntp knife cookbook upload sudo knife cookbook upload tomcat knife cookbook upload users knife cookbook upload sample knife role from file base-cloud.rb knife role from file tc.rb knife role from file sample.rb knife data bag create users knife data bag from file users mray.json
  • 40. Build it somewhere #EC2 knife ec2 server create -S mray -i ~/.ssh/mray.pem -x ubuntu -G default -I ami-a7a97dce -f m1.small -d omnibus -r 'role[base-cloud],role[tc],role[sample]' #Rackspace knife rackspace server create --image 110 --flavor 2 -i ~/.ssh/mray.pem -d omnibus -r 'role[base-cloud],role[tc],role[sample]' #CloudStack knife cs server create -S "small instance" -T "CentOS 5.5(64-bit) no GUI (KVM)" -i ~/.ssh/mray.pem -d omnibus -r 'role[base-cloud],role[tc],role[sample]' #Ubuntu Linux knife bootstrap test.lab -r 'role[webserver]' -i ~/.ssh/mray.pem -x ubuntu --sudo -d omnibus -r 'role[base-cloud],role[tc],role[sample]'
  • 41. Search • Search for nodes with Roles • Find configuration data • IP addresses • Hostnames • FQDNs http://www.flickr.com/photos/kathycsus/2686772625
  • 42. Pass results into Templates pool_members = search("node","role:webserver”) template "/etc/haproxy/haproxy.cfg" do source "haproxy-app_lb.cfg.erb" owner "root" group "root" mode 0644 variables :pool_members => pool_members.uniq notifies :restart, "service[haproxy]" end
  • 43. Pass results into Templates # Set up application listeners here. listen application 0.0.0.0:80 balance roundrobin <% @pool_members.each do |member| -%> server <%= member[:hostname] %> <%= member[:ipaddress] %>:> weight 1 maxconn 1 check <% end -%> <% if node["haproxy"]["enable_admin"] -%> listen admin 0.0.0.0:22002 mode http stats uri / <% end -%>
  • 44. So when this Graphite Nagios Jboss App Memcache Postgres Slaves Postgres Master
  • 45. Becomes this Graphite Nagios Jboss App Memcache Postgres Slaves Postgres Master
  • 46. Updates can be automatic Graphite Nagios Jboss App Memcache Postgres Slaves Postgres Master
  • 47. Count the resources • Load balancer config Graphite Nagios • Nagios host ping • Nagios host ssh Jboss App • Nagios host HTTP • Nagios host app health Memcache • Graphite CPU • Graphite Memory Postgres Slaves • Graphite Disk • Graphite SNMP • Memcache firewall • 12+ resource changes for 1 node addition • Postgres firewall Postgres authZ config
  • 48. CLONING CANNOT COPE WITH THIS • Chef can. http://www.flickr.com/photos/evelynishere/2798236471/
  • 49. Build anything • Simple internal applications • Complex external applications • Workstations • Hadoop clusters • IaaS infrastructure • PaaS infrastructure • SaaS applications • Storage systems • You name it http://www.flickr.com/photos/hyku/245010680/
  • 50. And manage it simply • Automatically reconfigure everything • Linux, Windows, Unixes, BSDs • Load balancers • Metrics collection systems • Monitoring systems • Cloud migrations become trivial http://www.flickr.com/photos/helico/404640681/
  • 51. The Chef Community • Apache License, Version 2.0 • 550+ Individual contributors • 100+ Corporate contributors • Dell, Rackspace,VMware, RightScale, Heroku, and many more • Nearly 400 cookbooks • http://community.opscode.com
  • 53. Thanks! matt@opscode.com www.opscode.com