SlideShare une entreprise Scribd logo
1  sur  75
Prepping the Kitchen - Chef Concepts
and Fundamentals



    someara@opscode.com
      www.opscode.com
Overview




• Infrastructure as code
• Configuration Management
    Strategies
•   Chef
Infrastructure as code
Infrastructure
"It is common to think in terms of individual machines
      rather than view an entire infrastructure as a
                    combined whole"

“A good infrastructure, whether departmental,
divisional, or enterprise-wide, is a single loosely-
coupled virtual machine, with hundreds or
thousands of hard drives and CPU's.”
      -- Bootstrapping an Infrastructure USENIX LISA ’98



          http://www.infrastructures.org/papers/bootstrap/bootstrap.html
.... as code!
•   Programmatically provision and
    configure
•   Treat like any other code base
•   Reconstruct operations from code
    repository, data backup, and bare
    metal resources.

                              http://www.flickr.com/photos/louisb/4555295187/
Considerations
                   •     Infrastructure changes over time
                   •     Entropy
                   •     Changing business requirements




http://www.flickr.com/photos/seatbelt67/502255276/
Methodology
              http://www.flickr.com/photos/drachmann/327122302/
Configuration Management
       Strategies
Manual
                                    Configuration
                                •     Labor intensive
                                •     Error prone
                                •     Hard to reproduce
                                •     Unsustainable

http://www.flickr.com/photos/pureimaginations/4805330106/
Scripting
•   Typically very brittle
•   Throw away, one off scripts
•   grep sed awk perl
•   curl | bash


                                  http://www.flickr.com/photos/40389360@N00/2428706650/
File
                                                  Distribution
                                                  •   NFS mounts
                                                  •   rdist
                                                  •   scp-on-a-for-loop
                                                  •   rsync on cron


http://www.flickr.com/photos/walkadog/4317655660
This used to be
          awesome
for i in `cat servers.txt` ; do scp ntp.conf root@$i:/etc/
ntpd.conf ; done
for i in `cat servers.txt` ; do ssh root@$i /etc/init.d/ntpd
restart ; done
for i in `cat servers.txt` ; do ssh root@$i chkconfig ntpd
on ; done


•   ^ does not scale


                                                               http://www.flickr.com/photos/alexerde/3479006495
Declarative
                                                        Syntax
                                                   •   Define policy
                                                   •   Say what, not how
                                                   •   Abstract interface to
                                                       resources
                                                   •   Enables some interesting
                                                       behavior
http://www.flickr.com/photos/bixentro/2591838509/
Declarative Syntax



Declarative Tools
•   LCFG
•   CFEngine
•   BCFG2
•   Puppet

• Chef
Declarative Syntax



package "ntp" do
 action :install
                                     Idempotence
                                     •
end
cookbook_file "/etc/ntp.conf" do
                                         You’ll hear this a lot
 source "ntp.conf"
 owner "root"                        •   Property of declarative
 group "root"                            interface
 mode 0644
 action :create
 notifies :restart, “service[ntpd]”
                                     •   Eliminates brittleness of
end
                                         scripting
service "ntpd" do
 action [:enable,:start]
                                     •   Identity function: f(x)=x
end
Declarative Syntax


while true do
  package "ntp" do
   action :install
                                       Idempotence
                                       •
  end
  cookbook_file "/etc/ntp.conf" do
                                           You’ll hear this a lot
   source "ntp.conf"
   owner "root"                        •   Property of declarative
   group "root"                            interface
   mode 0644
   action :create
   notifies :restart, “service[ntpd]”
                                       •   Eliminates brittleness of
  end
                                           scripting
  service "ntpd" do
   action [:enable,:start]
                                       •   Identity function: f(x)=x
  end                                  •   Safe to repeat
end
Declarative Syntax



                                                  Convergence
                                                  •   Agents “converge” a system to
                                                      desired state
                                                  •   Repetition inches closer to
                                                      desired state
                                                  •   It eventually gets there
                                                  •   SCIENCE!



http://www.flickr.com/photos/tolomea/4852616645/
Declarative Syntax



                                     Convergence
service "ntpd" do
 action [:enable,:start]
 ignore_failure true
end

cookbook_file "/etc/ntp.conf" do      •   Agents “converge” a system to
 source "ntp.conf"                       desired state
 owner "root"
 group "root"
 mode 0644                           •   Repetition inches closer to
 action :create                          desired state
                                     •
 notifies :restart, “service[ntpd]”
 ignore_failure true                     It eventually gets there
                                     •
end
                                         SCIENCE!
package "ntp" do
 action :install
 ignore_failure true
end
Declarative Syntax



# echo “boom” > /etc/ntp.conf ; 
chef-client
                                          Convergence
$ grep server /etc/ntp.conf | head -n 1
us.pool.ntp.org

$ ps -e | grep ntp
                                          •   Fights entropy, unauthorized
 1799 ?        00:00:00 ntpd
                                              changes, and gingivitis

# /etc/init.d/ntpd stop ; chef-client     •   Update function inputs to deal
                                              with changing requirements
ps -e | grep ntp
 1822 ?        00:00:00 ntpd
Config Generation
•   Often made by hand (still!?)
•   Stop that.
•   Generate them based on
    database content

• Infrastructures evolve
                                   http://www.flickr.com/photos/jabella/4753170413/
See Node


Application
See Nodes


Application


Application Database
See Nodes Grow


Application


App Databases
See Nodes Grow


App Servers


App Databases
See Nodes Grow


App LB


         App Servers


App Databases
See Nodes Grow


   App LBs


                   App Servers


   App Databases
See Nodes Grow

  App LBs

                 App Servers


  App DB Cache


  App DBs
Stitched together with configs


            App LBs

                           App Servers


            App DB Cache


            App DBs
Stitched together with configs


              App LBs

                            App Servers


             App DB Cache

          Floating IP?

             App DBs
Complexity increases quickly


           App LBs
                 Cache

                      App Servers
NoSQL            DB Cache

                 DB slaves

           DBs
Complexity increases very quickly
           DC2


DC1

                       DC3
Generate configs
•   Centralized generation
•   Version control!
•   Distribute with packages, Chef,
    git, whatever.



            http://www.flickr.com/photos/ssoosay/5126146763/
Generate configs
•   Local generation directly on nodes
•   Reduces management complexity
•   No need to distribute
•   Version control the programs instead



            http://www.flickr.com/photos/ssoosay/5126146763/
Chef
All That Stuff


•   Declarative interface to resources
•   Database of nodes and their roles
•   Grab remote configs
•   Generate configs locally
and more!


•   Data Driven Infrastructure
•   Use APIs to obtain data
    •   chef-server, SQL, anything.
•   Feed resources parameters
    •   IPs, FQDNs, memory sizes,
    •   Templates, package, firewall
        rules
Architecture


•   Code Repository
•   Chef Server
•   Chef Clients
•   Data Bags
•   Recipes and Cookbooks
•   Roles and Run Lists



                            http://www.flickr.com/photos/boedker/3871267007
Code Repository



     •   Version control
     •   Development
         workflows
     •   Sharing is Caring
Chef Server
                 Server
                   Server
                chef-server
                 Server
                   Server



                                •     Upload from laptop
                                      with knife
              RESTful API
   Cookbook
 Cookbook
Cookbook
                               Data Bag

  Knife                       Knife
                      Role
              Knife
Chef Clients
                                              Server
                                                Server
                                             chef-server
                                              Server
                                                Server


                                                                                    Knife

•   Clients are API users
•   Read                                RESTful API                         Knife
•   Write
•   Search
                 chef-client
                               chef-client    chef-client   chef-client   chef-client
Chef Clients
                                                Server
                                                  Server
                   someara.pub                 chef-server
                                                Server
                                                  Server
                   jtimberman.pub
                   node5.fqdn.pub
                                                                                      Knife   someara.pem
•   Clients are API users
•   Public keys on server                 RESTful API                         Knife       jtimberman.pem
•   Private keys local to
    machines

                   chef-client
                                 chef-client    chef-client   chef-client   chef-client
                                                                                           node5.fqdn.pem
Run Lists
 Server
   Server
chef-server
 Server
   Server



                                              Ohai!
   API                    chef-client
                                             Give me
                                        recipe[ntp::client]
                   ntp

                            node
              client.rb
Run Lists
 Server
   Server
chef-server
 Server
   Server



                                                          Ohai!
                                       chef-client
   API                                                   Give me
                                                       “ntp::client”,
                   ntp                               “openssh::server”
                             openssh
                                         node
              client.rb
                          server.rb
Run Lists
 Server
   Server
chef-server
 Server
   Server

                                                                               Ohai!
                                                       chef-client            Give me
   API
                                                                        “recipe[ntp::client]”,
                   ntp                                               “recipe[openssh::server]”,
                                                                         “recipe[apache]”,
                             openssh
                                                         node              “recipe[php]”
              client.rb                apache
                          server.rb             php

                                  default.rb
                                          default.rb
Roles
         Server
           Server
        chef-server
         Server
           Server
                                        Role    Recipe


           API
                                 Role


                      Role                     Recipe
                                        Role    Recipe
                                                 Recipe

Knife

                             Recipe
                              Recipe
                               Recipe
Roles
 Server
   Server
chef-server
 Server
   Server




                                                       chef-client         Ohai!
   API
                                                                          Give me
                   ntp                                                  “role[base]”,
                                                                     “role[webserver]”
                             openssh
                                                         node
              client.rb                apache
                          server.rb             php

                                  default.rb
                                          default.rb
Roles
 Server
   Server
chef-server
 Server
   Server
                                ntp
                                         openssh
                                                                    chef-client
   API                    client.rb                apache
                                                            php
                                      server.rb                                   “role[webserver]”
                                              default.rb
                    ntp                               default.rb     node
                             openssh
                                                            chef-client
              client.rb                   mysql
                          server.rb
                                      server.rb
                                                                          “role[database]”
                                                             node
Bootstrapping
   nodes
•   Get chef-client installed
•   Write run list to a file
•   “Press go”


                                http://www.flickr.com/photos/liftarn/1447521121/
Bootstrapping nodes


                                                     •   knife ec2 server create -r
                                                         ‘role[webserver]’
                                                     •   knife bootstrap 10.9.8.7 -r
                                                         ‘role[webserver]’
                                                     •   Cobbler




http://www.flickr.com/photos/hakonjarl/4010080214/
Bootstrapping nodes
                                  {
                                   "kernel": {
                                     "machine": "x86_64",
                                     "name": "Darwin",
                                     "os": "Darwin",
                                     "version": "Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010;


•
                                  root:xnu-1504.7.4~1/RELEASE_I386",
    Ohai generates a JSON          },
                                     "release": "10.4.0"

    attributes list                "platform_version": "10.6.4",


•
                                      "platform": "mac_os_x",
    Run list and attributes are       "platform_build": "10F569",
                                      "domain": "local",
    combined into a Node object       "os": "darwin",
                                      "current_user": "mray",


•
                                      "ohai_time": 1278602661.60043,
    Can be viewed and                 "os_version": "10.4.0",
                                      "uptime": "18 days 17 hours 49 minutes 18 seconds",
    searched through API              "ipaddress": "10.13.37.116",
                                      "hostname": "morbo",
                                      "fqdn": "morbomorbo.local",
                                      "uptime_seconds": 1619358
                                  }
Bootstrapping nodes



                                                     •   Run list is requested
                                                     •   Cookbooks downloaded
                                                     •   Recipes executed
                                                     •   Node saved to chef-server




http://www.flickr.com/photos/architopher/457885721
Cookbooks
    and Recipes
•   Cookbooks contain recipes
•   And everything they need to
    work
•   Templates, files, custom
    resources, etc

                                  http://www.flickr.com/photos/shutterhacks/4474421855/
Cookbooks
                                  $ tree -a cookbooks/haproxy/
                                         README.md
                                        attributes
                                           default.rb
•   Cookbooks contain recipes           metadata.rb

•   And everything they need to         recipes

    work                                   app_lb.rb
                                           default.rb
•   Templates, files, custom            templates
    resources, etc                        default
                                            haproxy-app_lb.cfg.erb
                                            haproxy-default.erb
                                            haproxy.cfg.erb
Recipes

                               package "haproxy" do
                                action :install
                               end

                               template "/etc/default/haproxy" do
                                source "haproxy-default.erb"
•   Recipes contain lists of    owner "root"
                                group "root"
    resources                   mode 0644
                                notifies :restart, "service[haproxy]"
                               end

                               service "haproxy" do
                                action [:enable, :start]
                               end
Resources
Resources


package "apache2" do
 version "2.2.11-2ubuntu2.6"
 action :install
end

template "/etc/apache2/apache2.conf" do
 source "apache2.conf.erb"
 owner "root"
 group "root"
 mode 0644
 action :create
end
Resources


                  package "apache2" do

•
                   version "2.2.11-2ubuntu2.6"
    Have a type    action :install
                  end

                  template "/etc/apache2/apache2.conf" do
                   source "apache2.conf.erb"
                   owner "root"
                   group "root"
                   mode 0644
                   action :create
                  end
Resources


                  package "apache2" do

•
                   version "2.2.11-2ubuntu2.6"
    Have a type    action :install

•
                  end
    Have a name
                  template "/etc/apache2/apache2.conf" do
                   source "apache2.conf.erb"
                   owner "root"
                   group "root"
                   mode 0644
                   action :create
                  end
Resources


                      package "apache2" do

•
                       version "2.2.11-2ubuntu2.6"
    Have a type        action :install

•
                      end
    Have a name
•
                      template "/etc/apache2/apache2.conf" do
    Have parameters    source "apache2.conf.erb"
                       owner "root"
                       group "root"
                       mode 0644
                       action :create
                      end
Resources


                                      package "apache2" do

•
                                       version "2.2.11-2ubuntu2.6"
    Have a type                        action :install

•
                                      end
    Have a name
•
                                      template "/etc/apache2/apache2.conf" do
    Have parameters                    source "apache2.conf.erb"
                                       owner "root"
•   Take action to put the resource    group "root"
                                       mode 0644
    in the declared state              action :create
                                      end
Searching




http://www.flickr.com/photos/fotos_medem/3399096196/
Searching


                                                       •   All object in Chef server are
                                                           indexed by Solr




http://www.flickr.com/photos/fotos_medem/3399096196/
Searching


                                                       •   All object in Chef server are
                                                           indexed by Solr
                                                       •   Can search through the API




http://www.flickr.com/photos/fotos_medem/3399096196/
Searching


                                                       •   All object in Chef server are
                                                           indexed by Solr
                                                       •   Can search through the API
                                                       •   From knife and in recipes




http://www.flickr.com/photos/fotos_medem/3399096196/
Searching


                                                       •   All object in Chef server are
                                                           indexed by Solr
                                                       •   Can search through the API
                                                       •   From knife and in recipes
                                                       •   Returns an array of JSON Node
                                                           objects



http://www.flickr.com/photos/fotos_medem/3399096196/
Systems Integration



knife search node role:webserver

 webservers = search("node", "role:webserver”)
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

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 -%>
Change
•   Various ways
•   Add or remove a node to the
    infrastructure
•   Run chef-client
Run chef-client

$ grep servers /etc/haproxy/haproxy.cfg

servers node2.mylan 10.9.8.10
servers node3.mylan 10.9.8.11

$ knife ec2 server create -r ‘webserver’
$ knife ec2 server create -r ‘webserver’

$ knife ssh ‘role:webserver’ chef-client
$ grep servers /etc/haproxy/haproxy.cfg

servers   node2.mylan   10.9.8.10
servers   node3.mylan   10.9.8.11
servers   node4.mylan   10.9.8.12
servers   node5.mylan   10.9.8.13
Change Inputs



   •     Edit recipes
   •     Edit run lists
   •     chef-client




http://www.flickr.com/photos/dhutchman/128541987
Out of slides!




http://www.flickr.com/photos/calonyr11/2630312566/
Questions?


    sales@opscode.com
     www.opscode.com

Contenu connexe

Tendances

Velocity 2011 Chef OpenStack Workshop
Velocity 2011 Chef OpenStack WorkshopVelocity 2011 Chef OpenStack Workshop
Velocity 2011 Chef OpenStack WorkshopChef Software, Inc.
 
Sensu and Sensibility - Puppetconf 2014
Sensu and Sensibility - Puppetconf 2014Sensu and Sensibility - Puppetconf 2014
Sensu and Sensibility - Puppetconf 2014Tomas Doran
 
Postgresql 9.0 HA at LOADAYS 2012
Postgresql 9.0 HA at LOADAYS 2012Postgresql 9.0 HA at LOADAYS 2012
Postgresql 9.0 HA at LOADAYS 2012Julien Pivotto
 
Real world Django deployment using Chef
Real world Django deployment using ChefReal world Django deployment using Chef
Real world Django deployment using Chefcoderanger
 
TXLF: Chef- Software Defined Infrastructure Today & Tomorrow
TXLF: Chef- Software Defined Infrastructure Today & TomorrowTXLF: Chef- Software Defined Infrastructure Today & Tomorrow
TXLF: Chef- Software Defined Infrastructure Today & TomorrowMatt Ray
 
SELF 2011: Deploying Django Application Stacks with Chef
SELF 2011: Deploying Django Application Stacks with ChefSELF 2011: Deploying Django Application Stacks with Chef
SELF 2011: Deploying Django Application Stacks with ChefChef Software, Inc.
 
Manage and Deploy your sites with Drush
Manage and Deploy your sites with DrushManage and Deploy your sites with Drush
Manage and Deploy your sites with DrushAmazee Labs
 
Open Source Logging and Monitoring Tools
Open Source Logging and Monitoring ToolsOpen Source Logging and Monitoring Tools
Open Source Logging and Monitoring ToolsPhase2
 
Verifying your Ansible Roles using Docker, Test Kitchen and Serverspec
Verifying your Ansible Roles using Docker, Test Kitchen and ServerspecVerifying your Ansible Roles using Docker, Test Kitchen and Serverspec
Verifying your Ansible Roles using Docker, Test Kitchen and ServerspecEdmund Dipple
 
Puppet getting started by Dirk Götz
Puppet getting started by Dirk GötzPuppet getting started by Dirk Götz
Puppet getting started by Dirk GötzNETWAYS
 
Automated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. AnsibleAutomated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. AnsibleAlberto Molina Coballes
 
Introduction to Puppet Scripting
Introduction to Puppet ScriptingIntroduction to Puppet Scripting
Introduction to Puppet ScriptingAchieve Internet
 
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Puppet
 
Sensu @ Yelp!: A Guided Tour
Sensu @ Yelp!: A Guided TourSensu @ Yelp!: A Guided Tour
Sensu @ Yelp!: A Guided TourKyle Anderson
 
Debugging Hive with Hadoop-in-the-Cloud by David Chaiken of Altiscale
Debugging Hive with Hadoop-in-the-Cloud by David Chaiken of AltiscaleDebugging Hive with Hadoop-in-the-Cloud by David Chaiken of Altiscale
Debugging Hive with Hadoop-in-the-Cloud by David Chaiken of AltiscaleData Con LA
 
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Puppet
 
Network Automation Tools
Network Automation ToolsNetwork Automation Tools
Network Automation ToolsEdwin Beekman
 
Chef for OpenStack: OpenStack Spring Summit 2013
Chef for OpenStack: OpenStack Spring Summit 2013Chef for OpenStack: OpenStack Spring Summit 2013
Chef for OpenStack: OpenStack Spring Summit 2013Matt Ray
 
London devops logging
London devops loggingLondon devops logging
London devops loggingTomas Doran
 
Using Vagrant
Using VagrantUsing Vagrant
Using Vagrantandygale
 

Tendances (20)

Velocity 2011 Chef OpenStack Workshop
Velocity 2011 Chef OpenStack WorkshopVelocity 2011 Chef OpenStack Workshop
Velocity 2011 Chef OpenStack Workshop
 
Sensu and Sensibility - Puppetconf 2014
Sensu and Sensibility - Puppetconf 2014Sensu and Sensibility - Puppetconf 2014
Sensu and Sensibility - Puppetconf 2014
 
Postgresql 9.0 HA at LOADAYS 2012
Postgresql 9.0 HA at LOADAYS 2012Postgresql 9.0 HA at LOADAYS 2012
Postgresql 9.0 HA at LOADAYS 2012
 
Real world Django deployment using Chef
Real world Django deployment using ChefReal world Django deployment using Chef
Real world Django deployment using Chef
 
TXLF: Chef- Software Defined Infrastructure Today & Tomorrow
TXLF: Chef- Software Defined Infrastructure Today & TomorrowTXLF: Chef- Software Defined Infrastructure Today & Tomorrow
TXLF: Chef- Software Defined Infrastructure Today & Tomorrow
 
SELF 2011: Deploying Django Application Stacks with Chef
SELF 2011: Deploying Django Application Stacks with ChefSELF 2011: Deploying Django Application Stacks with Chef
SELF 2011: Deploying Django Application Stacks with Chef
 
Manage and Deploy your sites with Drush
Manage and Deploy your sites with DrushManage and Deploy your sites with Drush
Manage and Deploy your sites with Drush
 
Open Source Logging and Monitoring Tools
Open Source Logging and Monitoring ToolsOpen Source Logging and Monitoring Tools
Open Source Logging and Monitoring Tools
 
Verifying your Ansible Roles using Docker, Test Kitchen and Serverspec
Verifying your Ansible Roles using Docker, Test Kitchen and ServerspecVerifying your Ansible Roles using Docker, Test Kitchen and Serverspec
Verifying your Ansible Roles using Docker, Test Kitchen and Serverspec
 
Puppet getting started by Dirk Götz
Puppet getting started by Dirk GötzPuppet getting started by Dirk Götz
Puppet getting started by Dirk Götz
 
Automated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. AnsibleAutomated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. Ansible
 
Introduction to Puppet Scripting
Introduction to Puppet ScriptingIntroduction to Puppet Scripting
Introduction to Puppet Scripting
 
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
 
Sensu @ Yelp!: A Guided Tour
Sensu @ Yelp!: A Guided TourSensu @ Yelp!: A Guided Tour
Sensu @ Yelp!: A Guided Tour
 
Debugging Hive with Hadoop-in-the-Cloud by David Chaiken of Altiscale
Debugging Hive with Hadoop-in-the-Cloud by David Chaiken of AltiscaleDebugging Hive with Hadoop-in-the-Cloud by David Chaiken of Altiscale
Debugging Hive with Hadoop-in-the-Cloud by David Chaiken of Altiscale
 
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
 
Network Automation Tools
Network Automation ToolsNetwork Automation Tools
Network Automation Tools
 
Chef for OpenStack: OpenStack Spring Summit 2013
Chef for OpenStack: OpenStack Spring Summit 2013Chef for OpenStack: OpenStack Spring Summit 2013
Chef for OpenStack: OpenStack Spring Summit 2013
 
London devops logging
London devops loggingLondon devops logging
London devops logging
 
Using Vagrant
Using VagrantUsing Vagrant
Using Vagrant
 

Similaire à Preppingthekitchen 1.0.3

Australian OpenStack User Group August 2012: Chef for OpenStack
Australian OpenStack User Group August 2012: Chef for OpenStackAustralian OpenStack User Group August 2012: Chef for OpenStack
Australian OpenStack User Group August 2012: Chef for OpenStackMatt Ray
 
Achieving Infrastructure Portability with Chef
Achieving Infrastructure Portability with ChefAchieving Infrastructure Portability with Chef
Achieving Infrastructure Portability with ChefMatt Ray
 
OpenStack Deployments with Chef
OpenStack Deployments with ChefOpenStack Deployments with Chef
OpenStack Deployments with ChefMatt Ray
 
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014Miguel Zuniga
 
From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...Yury Bushmelev
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to Chefkevsmith
 
under the covers -- chef in 20 minutes or less
under the covers -- chef in 20 minutes or lessunder the covers -- chef in 20 minutes or less
under the covers -- chef in 20 minutes or lesssarahnovotny
 
What's new in Docker - InfraKit - Docker Meetup Berlin 2016
What's new in Docker - InfraKit - Docker Meetup Berlin 2016What's new in Docker - InfraKit - Docker Meetup Berlin 2016
What's new in Docker - InfraKit - Docker Meetup Berlin 2016Patrick Chanezon
 
Kubernetes上で動作する機械学習モジュールの配信&管理基盤Rekcurd について
Kubernetes上で動作する機械学習モジュールの配信&管理基盤Rekcurd についてKubernetes上で動作する機械学習モジュールの配信&管理基盤Rekcurd について
Kubernetes上で動作する機械学習モジュールの配信&管理基盤Rekcurd についてLINE Corporation
 
Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chefLeanDog
 
Apache Spark the Hard Way: Challenges with Building an On-Prem Spark Analytic...
Apache Spark the Hard Way: Challenges with Building an On-Prem Spark Analytic...Apache Spark the Hard Way: Challenges with Building an On-Prem Spark Analytic...
Apache Spark the Hard Way: Challenges with Building an On-Prem Spark Analytic...Spark Summit
 
Chef for OpenStack December 2012
Chef for OpenStack December 2012Chef for OpenStack December 2012
Chef for OpenStack December 2012Matt Ray
 
Large-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesLarge-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesHiroshi SHIBATA
 
Taking Spinnaker for a spin @ London DevOps Meetup 36
Taking Spinnaker for a spin @ London DevOps Meetup 36Taking Spinnaker for a spin @ London DevOps Meetup 36
Taking Spinnaker for a spin @ London DevOps Meetup 36aleonhardt
 
Open Source Logging and Metrics Tools
Open Source Logging and Metrics ToolsOpen Source Logging and Metrics Tools
Open Source Logging and Metrics ToolsPhase2
 

Similaire à Preppingthekitchen 1.0.3 (20)

Australian OpenStack User Group August 2012: Chef for OpenStack
Australian OpenStack User Group August 2012: Chef for OpenStackAustralian OpenStack User Group August 2012: Chef for OpenStack
Australian OpenStack User Group August 2012: Chef for OpenStack
 
Chef for OpenStack- Fall 2012.pdf
Chef for OpenStack- Fall 2012.pdfChef for OpenStack- Fall 2012.pdf
Chef for OpenStack- Fall 2012.pdf
 
Achieving Infrastructure Portability with Chef
Achieving Infrastructure Portability with ChefAchieving Infrastructure Portability with Chef
Achieving Infrastructure Portability with Chef
 
OpenStack Deployments with Chef
OpenStack Deployments with ChefOpenStack Deployments with Chef
OpenStack Deployments with Chef
 
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
 
From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to Chef
 
under the covers -- chef in 20 minutes or less
under the covers -- chef in 20 minutes or lessunder the covers -- chef in 20 minutes or less
under the covers -- chef in 20 minutes or less
 
Top ten-list
Top ten-listTop ten-list
Top ten-list
 
Full-Stack CakePHP Deployment
Full-Stack CakePHP DeploymentFull-Stack CakePHP Deployment
Full-Stack CakePHP Deployment
 
Chef For OpenStack Overview
Chef For OpenStack OverviewChef For OpenStack Overview
Chef For OpenStack Overview
 
What's new in Docker - InfraKit - Docker Meetup Berlin 2016
What's new in Docker - InfraKit - Docker Meetup Berlin 2016What's new in Docker - InfraKit - Docker Meetup Berlin 2016
What's new in Docker - InfraKit - Docker Meetup Berlin 2016
 
Kubernetes上で動作する機械学習モジュールの配信&管理基盤Rekcurd について
Kubernetes上で動作する機械学習モジュールの配信&管理基盤Rekcurd についてKubernetes上で動作する機械学習モジュールの配信&管理基盤Rekcurd について
Kubernetes上で動作する機械学習モジュールの配信&管理基盤Rekcurd について
 
Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chef
 
Apache Spark the Hard Way: Challenges with Building an On-Prem Spark Analytic...
Apache Spark the Hard Way: Challenges with Building an On-Prem Spark Analytic...Apache Spark the Hard Way: Challenges with Building an On-Prem Spark Analytic...
Apache Spark the Hard Way: Challenges with Building an On-Prem Spark Analytic...
 
Chef for OpenStack December 2012
Chef for OpenStack December 2012Chef for OpenStack December 2012
Chef for OpenStack December 2012
 
SCALE 10x Build a Cloud Day
SCALE 10x Build a Cloud DaySCALE 10x Build a Cloud Day
SCALE 10x Build a Cloud Day
 
Large-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesLarge-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 Minutes
 
Taking Spinnaker for a spin @ London DevOps Meetup 36
Taking Spinnaker for a spin @ London DevOps Meetup 36Taking Spinnaker for a spin @ London DevOps Meetup 36
Taking Spinnaker for a spin @ London DevOps Meetup 36
 
Open Source Logging and Metrics Tools
Open Source Logging and Metrics ToolsOpen Source Logging and Metrics Tools
Open Source Logging and Metrics Tools
 

Dernier

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 

Dernier (20)

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 

Preppingthekitchen 1.0.3

  • 1.
  • 2. Prepping the Kitchen - Chef Concepts and Fundamentals someara@opscode.com www.opscode.com
  • 3. Overview • Infrastructure as code • Configuration Management Strategies • Chef
  • 5. Infrastructure "It is common to think in terms of individual machines rather than view an entire infrastructure as a combined whole" “A good infrastructure, whether departmental, divisional, or enterprise-wide, is a single loosely- coupled virtual machine, with hundreds or thousands of hard drives and CPU's.” -- Bootstrapping an Infrastructure USENIX LISA ’98 http://www.infrastructures.org/papers/bootstrap/bootstrap.html
  • 6. .... as code! • Programmatically provision and configure • Treat like any other code base • Reconstruct operations from code repository, data backup, and bare metal resources. http://www.flickr.com/photos/louisb/4555295187/
  • 7. Considerations • Infrastructure changes over time • Entropy • Changing business requirements http://www.flickr.com/photos/seatbelt67/502255276/
  • 8. Methodology http://www.flickr.com/photos/drachmann/327122302/
  • 10. Manual Configuration • Labor intensive • Error prone • Hard to reproduce • Unsustainable http://www.flickr.com/photos/pureimaginations/4805330106/
  • 11. Scripting • Typically very brittle • Throw away, one off scripts • grep sed awk perl • curl | bash http://www.flickr.com/photos/40389360@N00/2428706650/
  • 12. File Distribution • NFS mounts • rdist • scp-on-a-for-loop • rsync on cron http://www.flickr.com/photos/walkadog/4317655660
  • 13. This used to be awesome for i in `cat servers.txt` ; do scp ntp.conf root@$i:/etc/ ntpd.conf ; done for i in `cat servers.txt` ; do ssh root@$i /etc/init.d/ntpd restart ; done for i in `cat servers.txt` ; do ssh root@$i chkconfig ntpd on ; done • ^ does not scale http://www.flickr.com/photos/alexerde/3479006495
  • 14. Declarative Syntax • Define policy • Say what, not how • Abstract interface to resources • Enables some interesting behavior http://www.flickr.com/photos/bixentro/2591838509/
  • 15. Declarative Syntax Declarative Tools • LCFG • CFEngine • BCFG2 • Puppet • Chef
  • 16. Declarative Syntax package "ntp" do action :install Idempotence • end cookbook_file "/etc/ntp.conf" do You’ll hear this a lot source "ntp.conf" owner "root" • Property of declarative group "root" interface mode 0644 action :create notifies :restart, “service[ntpd]” • Eliminates brittleness of end scripting service "ntpd" do action [:enable,:start] • Identity function: f(x)=x end
  • 17. Declarative Syntax while true do package "ntp" do action :install Idempotence • end cookbook_file "/etc/ntp.conf" do You’ll hear this a lot source "ntp.conf" owner "root" • Property of declarative group "root" interface mode 0644 action :create notifies :restart, “service[ntpd]” • Eliminates brittleness of end scripting service "ntpd" do action [:enable,:start] • Identity function: f(x)=x end • Safe to repeat end
  • 18. Declarative Syntax Convergence • Agents “converge” a system to desired state • Repetition inches closer to desired state • It eventually gets there • SCIENCE! http://www.flickr.com/photos/tolomea/4852616645/
  • 19. Declarative Syntax Convergence service "ntpd" do action [:enable,:start] ignore_failure true end cookbook_file "/etc/ntp.conf" do • Agents “converge” a system to source "ntp.conf" desired state owner "root" group "root" mode 0644 • Repetition inches closer to action :create desired state • notifies :restart, “service[ntpd]” ignore_failure true It eventually gets there • end SCIENCE! package "ntp" do action :install ignore_failure true end
  • 20. Declarative Syntax # echo “boom” > /etc/ntp.conf ; chef-client Convergence $ grep server /etc/ntp.conf | head -n 1 us.pool.ntp.org $ ps -e | grep ntp • Fights entropy, unauthorized 1799 ? 00:00:00 ntpd changes, and gingivitis # /etc/init.d/ntpd stop ; chef-client • Update function inputs to deal with changing requirements ps -e | grep ntp 1822 ? 00:00:00 ntpd
  • 21. Config Generation • Often made by hand (still!?) • Stop that. • Generate them based on database content • Infrastructures evolve http://www.flickr.com/photos/jabella/4753170413/
  • 25. See Nodes Grow App Servers App Databases
  • 26. See Nodes Grow App LB App Servers App Databases
  • 27. See Nodes Grow App LBs App Servers App Databases
  • 28. See Nodes Grow App LBs App Servers App DB Cache App DBs
  • 29. Stitched together with configs App LBs App Servers App DB Cache App DBs
  • 30. Stitched together with configs App LBs App Servers App DB Cache Floating IP? App DBs
  • 31. Complexity increases quickly App LBs Cache App Servers NoSQL DB Cache DB slaves DBs
  • 32. Complexity increases very quickly DC2 DC1 DC3
  • 33. Generate configs • Centralized generation • Version control! • Distribute with packages, Chef, git, whatever. http://www.flickr.com/photos/ssoosay/5126146763/
  • 34. Generate configs • Local generation directly on nodes • Reduces management complexity • No need to distribute • Version control the programs instead http://www.flickr.com/photos/ssoosay/5126146763/
  • 35. Chef
  • 36. All That Stuff • Declarative interface to resources • Database of nodes and their roles • Grab remote configs • Generate configs locally
  • 37. and more! • Data Driven Infrastructure • Use APIs to obtain data • chef-server, SQL, anything. • Feed resources parameters • IPs, FQDNs, memory sizes, • Templates, package, firewall rules
  • 38. Architecture • Code Repository • Chef Server • Chef Clients • Data Bags • Recipes and Cookbooks • Roles and Run Lists http://www.flickr.com/photos/boedker/3871267007
  • 39. Code Repository • Version control • Development workflows • Sharing is Caring
  • 40. Chef Server Server Server chef-server Server Server • Upload from laptop with knife RESTful API Cookbook Cookbook Cookbook Data Bag Knife Knife Role Knife
  • 41. Chef Clients Server Server chef-server Server Server Knife • Clients are API users • Read RESTful API Knife • Write • Search chef-client chef-client chef-client chef-client chef-client
  • 42. Chef Clients Server Server someara.pub chef-server Server Server jtimberman.pub node5.fqdn.pub Knife someara.pem • Clients are API users • Public keys on server RESTful API Knife jtimberman.pem • Private keys local to machines chef-client chef-client chef-client chef-client chef-client node5.fqdn.pem
  • 43. Run Lists Server Server chef-server Server Server Ohai! API chef-client Give me recipe[ntp::client] ntp node client.rb
  • 44. Run Lists Server Server chef-server Server Server Ohai! chef-client API Give me “ntp::client”, ntp “openssh::server” openssh node client.rb server.rb
  • 45. Run Lists Server Server chef-server Server Server Ohai! chef-client Give me API “recipe[ntp::client]”, ntp “recipe[openssh::server]”, “recipe[apache]”, openssh node “recipe[php]” client.rb apache server.rb php default.rb default.rb
  • 46. Roles Server Server chef-server Server Server Role Recipe API Role Role Recipe Role Recipe Recipe Knife Recipe Recipe Recipe
  • 47. Roles Server Server chef-server Server Server chef-client Ohai! API Give me ntp “role[base]”, “role[webserver]” openssh node client.rb apache server.rb php default.rb default.rb
  • 48. Roles Server Server chef-server Server Server ntp openssh chef-client API client.rb apache php server.rb “role[webserver]” default.rb ntp default.rb node openssh chef-client client.rb mysql server.rb server.rb “role[database]” node
  • 49. Bootstrapping nodes • Get chef-client installed • Write run list to a file • “Press go” http://www.flickr.com/photos/liftarn/1447521121/
  • 50. Bootstrapping nodes • knife ec2 server create -r ‘role[webserver]’ • knife bootstrap 10.9.8.7 -r ‘role[webserver]’ • Cobbler http://www.flickr.com/photos/hakonjarl/4010080214/
  • 51. Bootstrapping nodes { "kernel": { "machine": "x86_64", "name": "Darwin", "os": "Darwin", "version": "Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; • root:xnu-1504.7.4~1/RELEASE_I386", Ohai generates a JSON }, "release": "10.4.0" attributes list "platform_version": "10.6.4", • "platform": "mac_os_x", Run list and attributes are "platform_build": "10F569", "domain": "local", combined into a Node object "os": "darwin", "current_user": "mray", • "ohai_time": 1278602661.60043, Can be viewed and "os_version": "10.4.0", "uptime": "18 days 17 hours 49 minutes 18 seconds", searched through API "ipaddress": "10.13.37.116", "hostname": "morbo", "fqdn": "morbomorbo.local", "uptime_seconds": 1619358 }
  • 52. Bootstrapping nodes • Run list is requested • Cookbooks downloaded • Recipes executed • Node saved to chef-server http://www.flickr.com/photos/architopher/457885721
  • 53. Cookbooks and Recipes • Cookbooks contain recipes • And everything they need to work • Templates, files, custom resources, etc http://www.flickr.com/photos/shutterhacks/4474421855/
  • 54. Cookbooks $ tree -a cookbooks/haproxy/ README.md attributes    default.rb • Cookbooks contain recipes metadata.rb • And everything they need to recipes work    app_lb.rb    default.rb • Templates, files, custom templates resources, etc default haproxy-app_lb.cfg.erb haproxy-default.erb haproxy.cfg.erb
  • 55. Recipes package "haproxy" do action :install end template "/etc/default/haproxy" do source "haproxy-default.erb" • Recipes contain lists of owner "root" group "root" resources mode 0644 notifies :restart, "service[haproxy]" end service "haproxy" do action [:enable, :start] end
  • 57. Resources package "apache2" do version "2.2.11-2ubuntu2.6" action :install end template "/etc/apache2/apache2.conf" do source "apache2.conf.erb" owner "root" group "root" mode 0644 action :create end
  • 58. Resources package "apache2" do • version "2.2.11-2ubuntu2.6" Have a type action :install end template "/etc/apache2/apache2.conf" do source "apache2.conf.erb" owner "root" group "root" mode 0644 action :create end
  • 59. Resources package "apache2" do • version "2.2.11-2ubuntu2.6" Have a type action :install • end Have a name template "/etc/apache2/apache2.conf" do source "apache2.conf.erb" owner "root" group "root" mode 0644 action :create end
  • 60. Resources package "apache2" do • version "2.2.11-2ubuntu2.6" Have a type action :install • end Have a name • template "/etc/apache2/apache2.conf" do Have parameters source "apache2.conf.erb" owner "root" group "root" mode 0644 action :create end
  • 61. Resources package "apache2" do • version "2.2.11-2ubuntu2.6" Have a type action :install • end Have a name • template "/etc/apache2/apache2.conf" do Have parameters source "apache2.conf.erb" owner "root" • Take action to put the resource group "root" mode 0644 in the declared state action :create end
  • 63. Searching • All object in Chef server are indexed by Solr http://www.flickr.com/photos/fotos_medem/3399096196/
  • 64. Searching • All object in Chef server are indexed by Solr • Can search through the API http://www.flickr.com/photos/fotos_medem/3399096196/
  • 65. Searching • All object in Chef server are indexed by Solr • Can search through the API • From knife and in recipes http://www.flickr.com/photos/fotos_medem/3399096196/
  • 66. Searching • All object in Chef server are indexed by Solr • Can search through the API • From knife and in recipes • Returns an array of JSON Node objects http://www.flickr.com/photos/fotos_medem/3399096196/
  • 67. Systems Integration knife search node role:webserver webservers = search("node", "role:webserver”)
  • 68. 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
  • 69. 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
  • 70. 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 -%>
  • 71. Change • Various ways • Add or remove a node to the infrastructure • Run chef-client
  • 72. Run chef-client $ grep servers /etc/haproxy/haproxy.cfg servers node2.mylan 10.9.8.10 servers node3.mylan 10.9.8.11 $ knife ec2 server create -r ‘webserver’ $ knife ec2 server create -r ‘webserver’ $ knife ssh ‘role:webserver’ chef-client $ grep servers /etc/haproxy/haproxy.cfg servers node2.mylan 10.9.8.10 servers node3.mylan 10.9.8.11 servers node4.mylan 10.9.8.12 servers node5.mylan 10.9.8.13
  • 73. Change Inputs • Edit recipes • Edit run lists • chef-client http://www.flickr.com/photos/dhutchman/128541987
  • 75. Questions? sales@opscode.com www.opscode.com

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. Specific, technical meaning.\nThink of an infrastructure holistically \nGraphic from Infrastructures.org\n.... 13 years ago\n\n
  6. We live in the future\nWe have the technology\nlet&amp;#x2019;s write us some infrastructure!\num... okay so how do we do that\n\n
  7. Let&amp;#x2019;s think about this...\n\n
  8. \nWhat do we code?\n\n
  9. \n
  10. Lovingly hand crafted systems\n\n
  11. curl that into your pipe and bash it\n
  12. \n
  13. (still is)\n
  14. Run locally on all nodes\nPull from server\nResource primitives are packages, files, directories, symlinks, mounts, routes, etc.\n
  15. \n
  16. Don&amp;#x2019;t talk about resources and providers yet. Save that for later.\nStress repeatability of individual operations\n
  17. Don&amp;#x2019;t talk about resources and providers yet. Save that for later.\nStress repeatability.\n
  18. Chef would actually fail here\n
  19. 2 runs to converge onto state\nfail, succeed, succeed\nbroken state\nsucceed, succeed, noop\n3rd run: noop, noop, noop\n\nORDER MATTERS BITCHES\n
  20. time + declarations == convergence\n^ don&amp;#x2019;t say that\n
  21. This goes for configuration files as well as registries or database settings\n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. Snowflakes.\nYour application is unique, and so is your infrastructure.\nThey evolve symbiotically.\n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. SSL encryption and stuff\n
  41. \n
  42. \n
  43. executed in order!\n
  44. executed in order!\n
  45. executed in order!\n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. Chef Resources are declarative.\n
  57. Chef Resources are declarative.\n
  58. Chef Resources are declarative.\n
  59. Chef Resources are declarative.\n
  60. Chef Resources are declarative.\n
  61. Chef Resources are declarative.\n
  62. Chef Resources are declarative.\n
  63. Chef Resources are declarative.\n
  64. Chef Resources are declarative.\n
  65. Chef Resources are declarative.\n
  66. Chef Resources are declarative.\n
  67. Chef Resources are declarative.\n
  68. Chef Resources are declarative.\n
  69. Chef Resources are declarative.\n
  70. Chef Resources are declarative.\n
  71. Chef Resources are declarative.\n
  72. Chef Resources are declarative.\n
  73. Chef Resources are declarative.\n
  74. Chef Resources are declarative.\n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. (still is)\n
  84. \n
  85. (still is)\n
  86. \n
  87. \n