0
DevOps                     &                         ChefFriday 16 March 12
DevOpsFriday 16 March 12
Devs   vs   OpsFriday 16 March 12
Devs   vs   OpsFriday 16 March 12
Devs     vs   Ops                     The Wall Of ConfusionFriday 16 March 12
Change                     vs                          StabilityFriday 16 March 12
A Meeting of Minds                         Follow code into                         the wild                      Accept c...
Buzzword:   DevOpsFriday 16 March 12
Buzzword:   DevOps     Buzzword                             Buzzword                  Buzzword                      Buzzwo...
Buzzword:   DevOps       Buzzword                             Buzzword                     Buzzword                       ...
Buzzword                        DevOps                Buzzword:               Buzzword              Buzzword Buzzword Buzz...
What is DevOps?Friday 16 March 12
What is DevOps?                             What is DevOps NOT?Friday 16 March 12
What is DevOps?                     They are making a play for our jobs                                       What is DevO...
Devs want root           What is DevOps?                     They are making a play for our jobs                          ...
DevOps is not a job title, it’s a philosophy                                            Devs want root           What is D...
DevOps is not a job title, it’s a philosophy                                            Devs want root           What is D...
DevOps, for meFriday 16 March 12
DevOps, for me:                       TestingFriday 16 March 12
DevOps, for me:                       Testing                                 MonitoringFriday 16 March 12
DevOps, for me:                          Testing                                    Monitoring                     Automat...
DevOps, for me:                     Testing         Monitoring    AutomationFriday 16 March 12
DevOps, for me:                     Testing   Don’t release broken things         Monitoring            Know when things b...
✔   ?Friday 16 March 12
SCCS:                     Source Code Control SystemFriday 16 March 12
SCCS:                     Source Code Control System                      1972                             40 Years Ago!Fr...
Revision Control    ✔Friday 16 March 12
Revision Control                                   Test Driven Development    ✔Friday 16 March 12
Revision Control                                   Test Driven Development Feature Branches    ✔Friday 16 March 12
Revision Control                                   Test Driven Development Feature Branches                              C...
Revision Control                                   Test Driven Development Feature Branches                              C...
Revision Control                                   Test Driven Development Feature Branches                              C...
AGILEFriday 16 March 12
AGILE OPS                                 ?Friday 16 March 12
AGILE OPS      Continuous Deployment       ?        Feature Flags   Dark Launches            Automated Recovery IMVU - 50+...
Instant Feedback                           Rollbacks          Confidence                     No fear of changeFriday 16 Mar...
Code   InfrastructureFriday 16 March 12
Infrastructure   CodeFriday 16 March 12
Infrastructure   As   CodeFriday 16 March 12
$  ssh  root@web1             Last  login:  Tue  Mar  13             #  apt-­‐get  install  apache2             ...       ...
ChefFriday 16 March 12
SERVER                                          chef-client on node    use knife to push                           retriev...
Chef/nodes/web1.jsonFriday 16 March 12
{              "access" : [ "developers", "designers" ],              "name": "web1",              "run_list": [ "role[bas...
{              "access" : [ "developers", "designers" ],              "name": "web1",              "run_list": [ "role[bas...
Chef/nodes/web1.json             Chef/roles/web.rbFriday 16 March 12
run_list("recipe[apache]",                     "role[monitoring]")Friday 16 March 12
run_list("recipe[apache]",                     "role[monitoring]")Friday 16 March 12
Chef/nodes/web1.json             Chef/roles/web.rb             Chef/cookbooks/apache/                        recipes/defau...
package "apache2" do                       action :install                     endFriday 16 March 12
apache_modules = [wsgi, ssl,                     auth_tkt, proxy_http,                     headers, rewrite, status]      ...
apache_modules = [wsgi, ssl,                     auth_tkt, proxy_http,                     headers, rewrite, status]      ...
package "apache2" do             case node[:platform]             when "centos","redhat","fedora","suse"                 p...
package "apache2" do             case node[:platform]             when "centos","redhat","fedora","suse"                 p...
Chef/nodes/web1.json             Chef/roles/web.rb             Chef/cookbooks/apache/                        recipes/defau...
default[:apache][:version] = "2.2"Friday 16 March 12
package "apache2" do                action :install                version "#{node[:apache][:version]}"              endFr...
Chef/nodes/web1.json             Chef/roles/web.rb             Chef/cookbooks/apache/                        recipes/defau...
template "#{node[:apache][:dir]}/apache2.conf" do            source "apache2.conf.erb"            owner "root"            ...
It’s all RubyFriday 16 March 12
It’s all Ruby   http://wiki.opscode.com/display/chef/Just+Enough+Ruby+for+Chef                      “Just Enough Ruby for ...
It’s all Ruby                        Let’s hackFriday 16 March 12
Chef/nodes/web1.json             Chef/roles/web.rb             Chef/cookbooks/apache/                        recipes/defau...
class Chef      class Recipe        def apache_ports(&block)          @node[:apache][:vhosts].each do |vh|              vh...
apache_ports do |p|                         firewall_port p do                             action :open                   ...
apache_ports do |p|                         firewall_port p do                             action :open                   ...
define :firewall_port, :action => :open do          if not params.has_key?(:port)              params[:port] = params[:nam...
Providers                package "apache2" do                  action :install                end                         ...
"#{File.expand_path(                Chef::Config[:file_cache_path]                    )}/handlers/yola.rb"Friday 16 March 12
"#{File.expand_path(                Chef::Config[:file_cache_path]                    )}/handlers/yola.rb"        class Yo...
"#{File.expand_path(                Chef::Config[:file_cache_path]                    )}/handlers/yola.rb"        class Yo...
Chef/nodes/web1.json             Chef/roles/web.rb             Chef/cookbooks/apache/                        recipes/defau...
Chef/nodes/web1.json             Chef/roles/web.rb             Chef/cookbooks/apache/                        recipes/defau...
default_attributes({                        "aws_region" => "usa-east"                     })                     default_...
Chef/nodes/web1.json             Chef/roles/web.rb             Chef/cookbooks/apache/                        recipes/defau...
{         "name": "Jonathan Hitchcock",         "id": "jonathan",         "groups": ["developers", "operations"],         ...
ProvisioningFriday 16 March 12
Provisioning          $ knife ec2 server create -r role[webserver]                              -I ami-7000f019 -f m1.smal...
Provisioning          $ knife ec2 server create -r role[webserver]                              -I ami-7000f019 -f m1.smal...
Integration                     configuration data vs configuration logicFriday 16 March 12
Integration             configuration vs configuration logic                     dataFriday 16 March 12
Integration             configuration vs configuration logic                     data                     Ohai      Collects...
(A side note on)     Attributes                default                     normal                       override          ...
(A side note on)     Attributes                default              cookbooks, data bags                     normal       ...
(Back to)   Integration             search(:node, role:webbackend) do |wb|               haproxy_backend "#{wb[:apache][:p...
Integration             search(:node, role:webbackend) do |wb|               haproxy_backend "#{wb[:apache][:port]}" do   ...
Jonathan Hitchcock                            @vhata                             github.com/vhataFriday 16 March 12
Upcoming SlideShare
Loading in...5
×

DevOps and Chef

8,772

Published on

DevOps as a buzzword has had a lot of attention recently. This presentation is my take on the origins and essence of the matter, as well as an introduction to how Chef, the open source configuration management software, can help to solve one of the problems an Operations team faces as it moves towards the DevOps goals.

Published in: Technology, News & Politics
1 Comment
13 Likes
Statistics
Notes
  • Write a comment...
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
8,772
On Slideshare
0
From Embeds
0
Number of Embeds
17
Actions
Shares
0
Downloads
299
Comments
1
Likes
13
Embeds 0
No embeds

No notes for slide

Transcript of "DevOps and Chef"

  1. 1. DevOps & ChefFriday 16 March 12
  2. 2. DevOpsFriday 16 March 12
  3. 3. Devs vs OpsFriday 16 March 12
  4. 4. Devs vs OpsFriday 16 March 12
  5. 5. Devs vs Ops The Wall Of ConfusionFriday 16 March 12
  6. 6. Change vs StabilityFriday 16 March 12
  7. 7. A Meeting of Minds Follow code into the wild Accept change: become agileFriday 16 March 12
  8. 8. Buzzword: DevOpsFriday 16 March 12
  9. 9. Buzzword: DevOps Buzzword Buzzword Buzzword Buzzword Buzzword Buzzword Buzzword BuzzwordFriday 16 March 12
  10. 10. Buzzword: DevOps Buzzword Buzzword Buzzword Buzz Lightyear Buzzword Buzzword Buzzword Buzzword Buzzword Buzzword Buzzword Buzzword Buzzword Buzzword BuzzwordFriday 16 March 12
  11. 11. Buzzword DevOps Buzzword: Buzzword Buzzword Buzzword Buzzword Buzzword Buzzword Buzzword Lightyear Buzzword Buzz Buzzword Buzzword Buzzword Buzzword Buzzword Buzzword Buzzword Buzzword Buzzword Buzzword Buzzword Buzzword Buzzword Buzz Aldrin Buzzword Buzzword BuzzwordFriday 16 March 12
  12. 12. What is DevOps?Friday 16 March 12
  13. 13. What is DevOps? What is DevOps NOT?Friday 16 March 12
  14. 14. What is DevOps? They are making a play for our jobs What is DevOps NOT?Friday 16 March 12
  15. 15. Devs want root What is DevOps? They are making a play for our jobs What is DevOps NOT?Friday 16 March 12
  16. 16. DevOps is not a job title, it’s a philosophy Devs want root What is DevOps? They are making a play for our jobs What is DevOps NOT?Friday 16 March 12
  17. 17. DevOps is not a job title, it’s a philosophy Devs want root What is DevOps? They are making a play for our jobs What is DevOps NOT? So many wordsFriday 16 March 12
  18. 18. DevOps, for meFriday 16 March 12
  19. 19. DevOps, for me: TestingFriday 16 March 12
  20. 20. DevOps, for me: Testing MonitoringFriday 16 March 12
  21. 21. DevOps, for me: Testing Monitoring AutomationFriday 16 March 12
  22. 22. DevOps, for me: Testing Monitoring AutomationFriday 16 March 12
  23. 23. DevOps, for me: Testing Don’t release broken things Monitoring Know when things break Automation Replace/fix broken things instantlyFriday 16 March 12
  24. 24. ✔ ?Friday 16 March 12
  25. 25. SCCS: Source Code Control SystemFriday 16 March 12
  26. 26. SCCS: Source Code Control System 1972 40 Years Ago!Friday 16 March 12
  27. 27. Revision Control ✔Friday 16 March 12
  28. 28. Revision Control Test Driven Development ✔Friday 16 March 12
  29. 29. Revision Control Test Driven Development Feature Branches ✔Friday 16 March 12
  30. 30. Revision Control Test Driven Development Feature Branches Continuous Integration ✔Friday 16 March 12
  31. 31. Revision Control Test Driven Development Feature Branches Continuous Integration Staging Environments ✔Friday 16 March 12
  32. 32. Revision Control Test Driven Development Feature Branches Continuous Integration Staging Environments AGILE ✔Friday 16 March 12
  33. 33. AGILEFriday 16 March 12
  34. 34. AGILE OPS ?Friday 16 March 12
  35. 35. AGILE OPS Continuous Deployment ? Feature Flags Dark Launches Automated Recovery IMVU - 50+ Flickr - 10+ Etsy - 25Friday 16 March 12
  36. 36. Instant Feedback Rollbacks Confidence No fear of changeFriday 16 March 12
  37. 37. Code InfrastructureFriday 16 March 12
  38. 38. Infrastructure CodeFriday 16 March 12
  39. 39. Infrastructure As CodeFriday 16 March 12
  40. 40. $  ssh  root@web1 Last  login:  Tue  Mar  13 #  apt-­‐get  install  apache2 ... #  vim  /etc/apache2/sites-­‐enabled/default.conf ... #  /etc/init.d/apache2  restart ... #  scp  web2:/root/.ssh/authorized_keys  ~/.sshFriday 16 March 12
  41. 41. ChefFriday 16 March 12
  42. 42. SERVER chef-client on node use knife to push retrieves config to server configuration from server use knife to query and CLIENT CLIENT ssh to clients (workstation) (server/node)Friday 16 March 12
  43. 43. Chef/nodes/web1.jsonFriday 16 March 12
  44. 44. { "access" : [ "developers", "designers" ], "name": "web1", "run_list": [ "role[base]", "role[web]", "recipe[splunk]" ]}Friday 16 March 12
  45. 45. { "access" : [ "developers", "designers" ], "name": "web1", "run_list": [ "role[base]", "role[web]", "recipe[splunk]" ]}Friday 16 March 12
  46. 46. Chef/nodes/web1.json Chef/roles/web.rbFriday 16 March 12
  47. 47. run_list("recipe[apache]", "role[monitoring]")Friday 16 March 12
  48. 48. run_list("recipe[apache]", "role[monitoring]")Friday 16 March 12
  49. 49. Chef/nodes/web1.json Chef/roles/web.rb Chef/cookbooks/apache/ recipes/default.rbFriday 16 March 12
  50. 50. package "apache2" do action :install endFriday 16 March 12
  51. 51. apache_modules = [wsgi, ssl, auth_tkt, proxy_http, headers, rewrite, status] apache_modules.each do |mod| apache_module mod do enable true notifies :restart, "service[apache2]" end endFriday 16 March 12
  52. 52. apache_modules = [wsgi, ssl, auth_tkt, proxy_http, headers, rewrite, status] apache_modules.each do |mod| apache_module mod do enable true notifies :restart, "service[apache2]" end endFriday 16 March 12
  53. 53. package "apache2" do case node[:platform] when "centos","redhat","fedora","suse" package_name "httpd" when "debian","ubuntu" package_name "apache2-mpm-prefork" end action :install endFriday 16 March 12
  54. 54. package "apache2" do case node[:platform] when "centos","redhat","fedora","suse" package_name "httpd" when "debian","ubuntu" package_name "apache2-mpm-prefork" end action :install endFriday 16 March 12
  55. 55. Chef/nodes/web1.json Chef/roles/web.rb Chef/cookbooks/apache/ recipes/default.rb attributes/default.rbFriday 16 March 12
  56. 56. default[:apache][:version] = "2.2"Friday 16 March 12
  57. 57. package "apache2" do action :install version "#{node[:apache][:version]}" endFriday 16 March 12
  58. 58. Chef/nodes/web1.json Chef/roles/web.rb Chef/cookbooks/apache/ recipes/default.rb attributes/default.rb templates/default/apache2.conf.erbFriday 16 March 12
  59. 59. template "#{node[:apache][:dir]}/apache2.conf" do source "apache2.conf.erb" owner "root" mode 0644 notifies :restart, resources(:service => "apache2") endFriday 16 March 12
  60. 60. It’s all RubyFriday 16 March 12
  61. 61. It’s all Ruby http://wiki.opscode.com/display/chef/Just+Enough+Ruby+for+Chef “Just Enough Ruby for Chef”Friday 16 March 12
  62. 62. It’s all Ruby Let’s hackFriday 16 March 12
  63. 63. Chef/nodes/web1.json Chef/roles/web.rb Chef/cookbooks/apache/ recipes/default.rb attributes/default.rb templates/default/apache2.conf.erb libraries/default.rbFriday 16 March 12
  64. 64. class Chef   class Recipe     def apache_ports(&block)       @node[:apache][:vhosts].each do |vh|        vh[:ports].each do |p|          block.call(p)          end       end     end   end endFriday 16 March 12
  65. 65. apache_ports do |p| firewall_port p do action :open end endFriday 16 March 12
  66. 66. apache_ports do |p| firewall_port p do action :open end endFriday 16 March 12
  67. 67. define :firewall_port, :action => :open do if not params.has_key?(:port) params[:port] = params[:name] end   if params[:action] == :open     execute "open #{params[:port]}" do       command "iptables -A INPUT --destination-port #{params[:port]} -j ACCEPT"     end   else     execute "close #{params[:port]}" do       command "iptables -A INPUT --destination-port #{params[:port]} -j DROP"     end   end endFriday 16 March 12
  68. 68. Providers package "apache2" do action :install end apt-get install yum install node[:platform] brew installFriday 16 March 12
  69. 69. "#{File.expand_path( Chef::Config[:file_cache_path] )}/handlers/yola.rb"Friday 16 March 12
  70. 70. "#{File.expand_path( Chef::Config[:file_cache_path] )}/handlers/yola.rb" class YolaHandler < Chef::Handler def report() run_status.updated_resources.each do |r| campfire_speak(r.to_s) end end endFriday 16 March 12
  71. 71. "#{File.expand_path( Chef::Config[:file_cache_path] )}/handlers/yola.rb" class YolaHandler < Chef::Handler def report() run_status.updated_resources.each do |r| campfire_speak(r.to_s) end end endFriday 16 March 12
  72. 72. Chef/nodes/web1.json Chef/roles/web.rb Chef/cookbooks/apache/ recipes/default.rb attributes/default.rb templates/default/apache2.conf.erb libraries/default.rb Chef/environments/production.rbFriday 16 March 12
  73. 73. Chef/nodes/web1.json Chef/roles/web.rb Chef/cookbooks/apache/ recipes/default.rb attributes/default.rb templates/default/apache2.conf.erb libraries/default.rb Chef/environments/production.rb Chef/environments/testing.rbFriday 16 March 12
  74. 74. default_attributes({ "aws_region" => "usa-east" }) default_attributes({ "aws_region" => "usa-east", "logging" => { "debug" => true } })Friday 16 March 12
  75. 75. Chef/nodes/web1.json Chef/roles/web.rb Chef/cookbooks/apache/ recipes/default.rb attributes/default.rb templates/default/apache2.conf.erb libraries/default.rb Chef/environments/production.rb Chef/environments/testing.rb Chef/data_bags/employees/jonathan.jsonFriday 16 March 12
  76. 76. { "name": "Jonathan Hitchcock", "id": "jonathan", "groups": ["developers", "operations"], "ssh_keys": [ { "key": "AAAB3NzC1yc2EAAAABIwAAAQEA3advEyDE0aEo==" } ] }Friday 16 March 12
  77. 77. ProvisioningFriday 16 March 12
  78. 78. Provisioning $ knife ec2 server create -r role[webserver] -I ami-7000f019 -f m1.smallFriday 16 March 12
  79. 79. Provisioning $ knife ec2 server create -r role[webserver] -I ami-7000f019 -f m1.small Amazon EC2 Openstack Rackspace Cloud libvirt Eucalyptus KVM Kickstart XEN VagrantFriday 16 March 12
  80. 80. Integration configuration data vs configuration logicFriday 16 March 12
  81. 81. Integration configuration vs configuration logic dataFriday 16 March 12
  82. 82. Integration configuration vs configuration logic data Ohai Collects infrastructure data Stored and indexed in NoSQL Search and useFriday 16 March 12
  83. 83. (A side note on) Attributes default normal override automaticFriday 16 March 12
  84. 84. (A side note on) Attributes default cookbooks, data bags normal node definitions override for special cases automatic ohaiFriday 16 March 12
  85. 85. (Back to) Integration search(:node, role:webbackend) do |wb| haproxy_backend "#{wb[:apache][:port]}" do action :create end end Systems auto-discover each other Configuration is responsive to changesFriday 16 March 12
  86. 86. Integration search(:node, role:webbackend) do |wb| haproxy_backend "#{wb[:apache][:port]}" do action :create end end Systems auto-discover each other Configuration is responsive to changes So you don’t have to be!Friday 16 March 12
  87. 87. Jonathan Hitchcock @vhata github.com/vhataFriday 16 March 12
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×