SlideShare a Scribd company logo
1 of 20
Download to read offline
INtroduction to
                        Chef
                             Cooking 5 Star Infrastructure




Wednesday, November 21, 12
What is Chef ?

                   • Chef is a infrastructure configuration
                     management platform to create
                     infrastructure as code
                   • Policy enforcement tool
                   • Continuous integration tool
                   • What you make it


Wednesday, November 21, 12
Client Server Architecture




Wednesday, November 21, 12
Chef Components

                   • Ohai: Data collector System info and
                     statistics
                   • Chef-Server: Code Repository
                   • Chef-client: Client software
                   • Knife: Command line interface
                   • Shef: Testing CLI / Development Client


Wednesday, November 21, 12
Chef Structures

               •      Roles: is a grouping of cookbooks and recipes shared between a type of
                      node

               •      Node: is a machine that has roles and attributes assigned to it

               •      Cookbook: a collection of recipes

               •      Recipe: a collection of resources

               •      Resource: basic unit of work, package, service, template, file, exec, etc

               •      Attributes: node data such as IP address, Hostname, any value you set

               •      Data-bag: data store of globally available JSON data




Wednesday, November 21, 12
What is in a Cookbook
                                              What goes where


                   •         Attribute node specify data

                   •         Definitions allow you to create new resources by stringing together
                             existing resources.

                   •         Files you want to deploy via a cookbook

                   •         Template ERB Template files that pull data from the node

                   •         Resource custom define resource for the cookbook

                   •         Recipes default.rb and other Recipes

                   •         Libraries allow you to include arbitrary Ruby code, either to extend
                             Chef's language or to implement your own classes directly.




Wednesday, November 21, 12
Master chefs tool of
                           choice KNIFE
              Knife It is used by administrators to interact with the Chef Server API and the
              local Chef repository. It provides the capability to manipulate nodes,
              cookbooks, roles, data-bags, environments, etc., and can also be used to
              provision cloud resources and to bootstrap systems.


                       knife sub-command [ARGUMENTS] (options)

                             knife data bag create BAG
                             knife cookbook list (options)
                             etc




Wednesday, November 21, 12
Roles
                    A role is a way to define certain patterns and processes that exist across nodes
    knife node run_list add NODE "role[ROLE NAME]"

    knife node run_list add NODE "role[ROLE NAME 1],role[ROLE NAME 2],role[ROLE NAME 3]"

    knife role list
                                    knife role create foobar

                                    {
                                        "name": "foobar",
                                        "default_attributes": {
                                        },
                                        "json_class": "Chef::Role",
                                        "run_list": ["recipe[apache2]",
                                            "recipe[apache2::mod_ssl]",
                                            "role[monitor]"
                                        ],
                                        "description": "",
                                        "chef_type": "role",
                                        "override_attributes": {
                                        }
                                    }




Wednesday, November 21, 12
Creating cookbooks
                              knife cookbook create MYCOOKBOOK




Wednesday, November 21, 12
Recipes in Cookbooks

             •      Recipe names are related to cookbook structure. Putting recipe[foo::bar] in a node’s run list results in
                    cookbooks/foo/recipes/bar.rb being downloaded from chef-server and executed.

             •      There is a special recipe in every cookbook called default.rb. It is executed either by specifying
                    recipe[foo] or recipe[foo::default] explicitly.

             •      Default.rb is a good place to put common stuff when writing cookbooks with multiple recipes, but
                    we’re going to keep it simple and just use default.rb for everything




Wednesday, November 21, 12
Recipe
                                                               Simple Example of a Recipe
         yum_package "autofs" do
          action :install
         end

         service "autofs" do
          supports :restart => true, :status => true, :reload => true
          action [:enable, :start]
         end

         template "/etc/auto.master" do
          source "auto.master.erb"
          owner "root"
          mode "0644"
          notifies :restart, resources(:service => "autofs" )
         end

         template "/etc/auto.home" do
           source "auto.home.erb"
           owner "root"
           mode "0644"
           variables({
         !       :fqdn => node[:fqdn],
         !       :autofs_server => node[:autofs_server],
         !       })
           #notifies :restart, resources(:service => node[:autofs][:service])
           notifies :restart, resources(:service => "autofs" )
         end

Wednesday, November 21, 12
Common Resources
             service "memcached" do
             action :nothing
             supports :status => true, :start => true, :stop => true, :restart => true
             end

             package "some_package" do
             provider Chef::Provider::Package::Rubygems
             end

             yum_package "netpbm" do
             action :install
             end

             template "/tmp/config.conf" do
             source "config.conf.erb"
             variables(
             :config_var => node[:configs][:config_var]
             )
             end

             file "/tmp/something" do
             mode "644"
             end



Wednesday, November 21, 12
ERB Templates
            <%=
            if node[:domain] == "dc1.company.org"
               node.set['autofs_server'] = '10.1.4.120'
            end

            if node[:domain] == "dc2.company.org"
               node.set['autofs_server'] = '10.100.0.11'
            end
            %>



            *  -fstype=nfs,rw,nosuid,nodev,intr,soft <%= node[:autofs_server] %>:/
            home_vol_01/&




Wednesday, November 21, 12
Data-bags
             These are JSON Objects stored as Key value
             pairs or sub objects
                    {
                             "id": "some_data_bag_item",
                             "production" : {
                                # Hash with all your data here
                             },
                             "testing" : {
                                # Hash with all your data here
                             }
                    }

Wednesday, November 21, 12
Attributes
     Are simple key value stores that can be set on different object pragmatically

       Attributes may be set on the node from the following objects
       • cookbooks
       • environments (Chef 0.10.0 or above only)
       • roles
       • nodes




Wednesday, November 21, 12
Working With
                                        Attributes
            See the full documentation for implementation Api
           default["apache"]["dir"]          = "/etc/apache2"
           default["apache"]["listen_ports"] = [ "80","443" ]
           node.default["apache"]["dir"]          = "/etc/apache2"
           node.default["apache"]["listen_ports"] = [ "80","443" ]
           node.set['apache2']['proxy_to_unicorn'] = node['rails']['use_unicorn']   normal / set Attribute


           Precedence

           The precedence of the attributes is as follows, from low to high:
            1. default attributes applied in an attributes file
            2. default attributes applied in an environment
            3. default attributes applied in a role
            4. default attributes applied on a node directly in a recipe
            5. normal or set attributes applied in an attributes file
            6. normal or set attributes applied on a node directly in a recipe
            7. override attributes applied in an attributes file
            8. override attributes applied in a role
            9. override attributes applied in an environment
            10.override attributes applied on a node directly in a recipe
            11.automatic attributes generated by Ohai
           default attributes applied in an attributes file have the lowest priority and automatic attributes generated by
           Ohai have the highest priority.
           Write your cookbooks with default attributes, but override these with role-specific or node-specific values as
           necessary.



Wednesday, November 21, 12
Working OHAI
             Ohai detects data about your operating system. It can be used standalone, but
             its primary purpose is to provide node data to Chef.

                   •         When invoked, it collects detailed, extensible information about the machine it's running on,
                             including Chef configuration, hostname, FQDN, networking, memory, CPU, platform, and
                             kernel data.

                   •         When used standalone, Ohai will print out a JSON data blob for all the known data about
                             your system.

                   •         When used with Chef, that JSON output is reported back via "automatic" node attributes to
                             update the node object on the chef-server.

                   •         Ohai plugins provide additional information about your system infrastructure - Custom
                             Ohai Plugin to gather that other information.




Wednesday, November 21, 12
Jenkins and Branching

                   • Roll forward methodology a rollback is
                     a push forward in version but pervious
                     production push locked branch.
                   • Multiple branches to be compiled
                             •   Post Production ( Previous stable push branch)

                             •   Pre Production ( Staging 2 push or current push brach )

                             •   Testing ( Smoke testing push in staging 1 )




Wednesday, November 21, 12
Continues integration
                          With Chef

                   • Automated Testing and Building Env
                   • Smoke tests on staging 1 environments
                   • Staging 1 one Colo 10% yum repo
                   • Staging 2 multi Colo 50% yum repo
                   • Production 100% yum repo


Wednesday, November 21, 12
QUESTIONS ?




Wednesday, November 21, 12

More Related Content

What's hot

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
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.jsAdrien Guéret
 
Puppet atbazaarvoice
Puppet atbazaarvoicePuppet atbazaarvoice
Puppet atbazaarvoiceDave Barcelo
 
July 2012 HUG: Overview of Oozie Qualification Process
July 2012 HUG: Overview of Oozie Qualification ProcessJuly 2012 HUG: Overview of Oozie Qualification Process
July 2012 HUG: Overview of Oozie Qualification ProcessYahoo Developer Network
 
Fixing Growing Pains With Puppet Data Patterns
Fixing Growing Pains With Puppet Data PatternsFixing Growing Pains With Puppet Data Patterns
Fixing Growing Pains With Puppet Data PatternsMartin Jackson
 
Advanced Technology for Web Application Design
Advanced Technology for Web Application DesignAdvanced Technology for Web Application Design
Advanced Technology for Web Application DesignBryce Kerley
 
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014Amazon Web Services
 
May 2012 HUG: Oozie: Towards a scalable Workflow Management System for Hadoop
May 2012 HUG: Oozie: Towards a scalable Workflow Management System for HadoopMay 2012 HUG: Oozie: Towards a scalable Workflow Management System for Hadoop
May 2012 HUG: Oozie: Towards a scalable Workflow Management System for HadoopYahoo Developer Network
 
Automation and Ansible
Automation and AnsibleAutomation and Ansible
Automation and Ansiblejtyr
 
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, PuppetPuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, PuppetPuppet
 
ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON Padma shree. T
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Drupalcon Paris
 
02 Hadoop deployment and configuration
02 Hadoop deployment and configuration02 Hadoop deployment and configuration
02 Hadoop deployment and configurationSubhas Kumar Ghosh
 

What's hot (20)

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
 
Snakes on a Treadmill
Snakes on a TreadmillSnakes on a Treadmill
Snakes on a Treadmill
 
Ruby talk romania
Ruby talk romaniaRuby talk romania
Ruby talk romania
 
PHP API
PHP APIPHP API
PHP API
 
Fatc
FatcFatc
Fatc
 
jQuery Objects
jQuery ObjectsjQuery Objects
jQuery Objects
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
Puppet atbazaarvoice
Puppet atbazaarvoicePuppet atbazaarvoice
Puppet atbazaarvoice
 
July 2012 HUG: Overview of Oozie Qualification Process
July 2012 HUG: Overview of Oozie Qualification ProcessJuly 2012 HUG: Overview of Oozie Qualification Process
July 2012 HUG: Overview of Oozie Qualification Process
 
Fixing Growing Pains With Puppet Data Patterns
Fixing Growing Pains With Puppet Data PatternsFixing Growing Pains With Puppet Data Patterns
Fixing Growing Pains With Puppet Data Patterns
 
Advanced Technology for Web Application Design
Advanced Technology for Web Application DesignAdvanced Technology for Web Application Design
Advanced Technology for Web Application Design
 
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
 
May 2012 HUG: Oozie: Towards a scalable Workflow Management System for Hadoop
May 2012 HUG: Oozie: Towards a scalable Workflow Management System for HadoopMay 2012 HUG: Oozie: Towards a scalable Workflow Management System for Hadoop
May 2012 HUG: Oozie: Towards a scalable Workflow Management System for Hadoop
 
Automation and Ansible
Automation and AnsibleAutomation and Ansible
Automation and Ansible
 
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, PuppetPuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
 
ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON ACADGILD:: HADOOP LESSON
ACADGILD:: HADOOP LESSON
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
 
Oak Lucene Indexes
Oak Lucene IndexesOak Lucene Indexes
Oak Lucene Indexes
 
ERGroupware
ERGroupwareERGroupware
ERGroupware
 
02 Hadoop deployment and configuration
02 Hadoop deployment and configuration02 Hadoop deployment and configuration
02 Hadoop deployment and configuration
 

Similar to Cooking 5 Star Infrastructure with Chef

Chef, Devops, and You
Chef, Devops, and YouChef, Devops, and You
Chef, Devops, and YouBryan Berry
 
Velocity 2011 Chef OpenStack Workshop
Velocity 2011 Chef OpenStack WorkshopVelocity 2011 Chef OpenStack Workshop
Velocity 2011 Chef OpenStack WorkshopChef Software, Inc.
 
AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013
AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013
AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013Amazon Web Services
 
Cookbook refactoring & abstracting logic to Ruby(gems)
Cookbook refactoring & abstracting logic to Ruby(gems)Cookbook refactoring & abstracting logic to Ruby(gems)
Cookbook refactoring & abstracting logic to Ruby(gems)Chef Software, Inc.
 
Chef Fundamentals Training Series Module 2: Workstation Setup
Chef Fundamentals Training Series Module 2: Workstation SetupChef Fundamentals Training Series Module 2: Workstation Setup
Chef Fundamentals Training Series Module 2: Workstation SetupChef Software, Inc.
 
Practical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppPractical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppSmartLogic
 
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
 
Kickstarter - Chef Opswork
Kickstarter - Chef OpsworkKickstarter - Chef Opswork
Kickstarter - Chef OpsworkHamza Waqas
 
What Makes a Good Cookbook?
What Makes a Good Cookbook?What Makes a Good Cookbook?
What Makes a Good Cookbook?Julian Dunn
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practicesBas Meijer
 
Chef for Openstack
Chef for OpenstackChef for Openstack
Chef for OpenstackMohit Sethi
 
Node object and roles - Fundamentals Webinar Series Part 3
Node object and roles - Fundamentals Webinar Series Part 3Node object and roles - Fundamentals Webinar Series Part 3
Node object and roles - Fundamentals Webinar Series Part 3Chef
 
Cook Infrastructure with chef -- Justeat.IN
Cook Infrastructure with chef  -- Justeat.INCook Infrastructure with chef  -- Justeat.IN
Cook Infrastructure with chef -- Justeat.INRajesh Hegde
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to Chefkevsmith
 
Achieving Infrastructure Portability with Chef
Achieving Infrastructure Portability with ChefAchieving Infrastructure Portability with Chef
Achieving Infrastructure Portability with ChefMatt Ray
 

Similar to Cooking 5 Star Infrastructure with Chef (20)

Configuration management with Chef
Configuration management with ChefConfiguration management with Chef
Configuration management with Chef
 
Chef advance
Chef advanceChef advance
Chef advance
 
Chef, Devops, and You
Chef, Devops, and YouChef, Devops, and You
Chef, Devops, and You
 
Velocity 2011 Chef OpenStack Workshop
Velocity 2011 Chef OpenStack WorkshopVelocity 2011 Chef OpenStack Workshop
Velocity 2011 Chef OpenStack Workshop
 
AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013
AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013
AWS OpsWorks Under the Hood (DMG304) | AWS re:Invent 2013
 
Cookbook refactoring & abstracting logic to Ruby(gems)
Cookbook refactoring & abstracting logic to Ruby(gems)Cookbook refactoring & abstracting logic to Ruby(gems)
Cookbook refactoring & abstracting logic to Ruby(gems)
 
Chef Fundamentals Training Series Module 2: Workstation Setup
Chef Fundamentals Training Series Module 2: Workstation SetupChef Fundamentals Training Series Module 2: Workstation Setup
Chef Fundamentals Training Series Module 2: Workstation Setup
 
Practical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppPractical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails App
 
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
 
Chef for openstack
Chef for openstackChef for openstack
Chef for openstack
 
Kickstarter - Chef Opswork
Kickstarter - Chef OpsworkKickstarter - Chef Opswork
Kickstarter - Chef Opswork
 
What Makes a Good Cookbook?
What Makes a Good Cookbook?What Makes a Good Cookbook?
What Makes a Good Cookbook?
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practices
 
Chef for Openstack
Chef for OpenstackChef for Openstack
Chef for Openstack
 
Node object and roles - Fundamentals Webinar Series Part 3
Node object and roles - Fundamentals Webinar Series Part 3Node object and roles - Fundamentals Webinar Series Part 3
Node object and roles - Fundamentals Webinar Series Part 3
 
Cook Infrastructure with chef -- Justeat.IN
Cook Infrastructure with chef  -- Justeat.INCook Infrastructure with chef  -- Justeat.IN
Cook Infrastructure with chef -- Justeat.IN
 
Chef training - Day2
Chef training - Day2Chef training - Day2
Chef training - Day2
 
DevOps
DevOpsDevOps
DevOps
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to Chef
 
Achieving Infrastructure Portability with Chef
Achieving Infrastructure Portability with ChefAchieving Infrastructure Portability with Chef
Achieving Infrastructure Portability with Chef
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 

Recently uploaded (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 

Cooking 5 Star Infrastructure with Chef

  • 1. INtroduction to Chef Cooking 5 Star Infrastructure Wednesday, November 21, 12
  • 2. What is Chef ? • Chef is a infrastructure configuration management platform to create infrastructure as code • Policy enforcement tool • Continuous integration tool • What you make it Wednesday, November 21, 12
  • 4. Chef Components • Ohai: Data collector System info and statistics • Chef-Server: Code Repository • Chef-client: Client software • Knife: Command line interface • Shef: Testing CLI / Development Client Wednesday, November 21, 12
  • 5. Chef Structures • Roles: is a grouping of cookbooks and recipes shared between a type of node • Node: is a machine that has roles and attributes assigned to it • Cookbook: a collection of recipes • Recipe: a collection of resources • Resource: basic unit of work, package, service, template, file, exec, etc • Attributes: node data such as IP address, Hostname, any value you set • Data-bag: data store of globally available JSON data Wednesday, November 21, 12
  • 6. What is in a Cookbook What goes where • Attribute node specify data • Definitions allow you to create new resources by stringing together existing resources. • Files you want to deploy via a cookbook • Template ERB Template files that pull data from the node • Resource custom define resource for the cookbook • Recipes default.rb and other Recipes • Libraries allow you to include arbitrary Ruby code, either to extend Chef's language or to implement your own classes directly. Wednesday, November 21, 12
  • 7. Master chefs tool of choice KNIFE Knife It is used by administrators to interact with the Chef Server API and the local Chef repository. It provides the capability to manipulate nodes, cookbooks, roles, data-bags, environments, etc., and can also be used to provision cloud resources and to bootstrap systems. knife sub-command [ARGUMENTS] (options) knife data bag create BAG knife cookbook list (options) etc Wednesday, November 21, 12
  • 8. Roles A role is a way to define certain patterns and processes that exist across nodes knife node run_list add NODE "role[ROLE NAME]" knife node run_list add NODE "role[ROLE NAME 1],role[ROLE NAME 2],role[ROLE NAME 3]" knife role list knife role create foobar {     "name": "foobar",     "default_attributes": {     },     "json_class": "Chef::Role",     "run_list": ["recipe[apache2]", "recipe[apache2::mod_ssl]", "role[monitor]"     ],     "description": "",     "chef_type": "role",     "override_attributes": {     } } Wednesday, November 21, 12
  • 9. Creating cookbooks knife cookbook create MYCOOKBOOK Wednesday, November 21, 12
  • 10. Recipes in Cookbooks • Recipe names are related to cookbook structure. Putting recipe[foo::bar] in a node’s run list results in cookbooks/foo/recipes/bar.rb being downloaded from chef-server and executed. • There is a special recipe in every cookbook called default.rb. It is executed either by specifying recipe[foo] or recipe[foo::default] explicitly. • Default.rb is a good place to put common stuff when writing cookbooks with multiple recipes, but we’re going to keep it simple and just use default.rb for everything Wednesday, November 21, 12
  • 11. Recipe Simple Example of a Recipe yum_package "autofs" do action :install end service "autofs" do supports :restart => true, :status => true, :reload => true action [:enable, :start] end template "/etc/auto.master" do source "auto.master.erb" owner "root" mode "0644" notifies :restart, resources(:service => "autofs" ) end template "/etc/auto.home" do source "auto.home.erb" owner "root" mode "0644" variables({ ! :fqdn => node[:fqdn], ! :autofs_server => node[:autofs_server], ! }) #notifies :restart, resources(:service => node[:autofs][:service]) notifies :restart, resources(:service => "autofs" ) end Wednesday, November 21, 12
  • 12. Common Resources service "memcached" do action :nothing supports :status => true, :start => true, :stop => true, :restart => true end package "some_package" do provider Chef::Provider::Package::Rubygems end yum_package "netpbm" do action :install end template "/tmp/config.conf" do source "config.conf.erb" variables( :config_var => node[:configs][:config_var] ) end file "/tmp/something" do mode "644" end Wednesday, November 21, 12
  • 13. ERB Templates <%= if node[:domain] == "dc1.company.org" node.set['autofs_server'] = '10.1.4.120' end if node[:domain] == "dc2.company.org" node.set['autofs_server'] = '10.100.0.11' end %> * -fstype=nfs,rw,nosuid,nodev,intr,soft <%= node[:autofs_server] %>:/ home_vol_01/& Wednesday, November 21, 12
  • 14. Data-bags These are JSON Objects stored as Key value pairs or sub objects { "id": "some_data_bag_item", "production" : { # Hash with all your data here }, "testing" : { # Hash with all your data here } } Wednesday, November 21, 12
  • 15. Attributes Are simple key value stores that can be set on different object pragmatically Attributes may be set on the node from the following objects • cookbooks • environments (Chef 0.10.0 or above only) • roles • nodes Wednesday, November 21, 12
  • 16. Working With Attributes See the full documentation for implementation Api default["apache"]["dir"]          = "/etc/apache2" default["apache"]["listen_ports"] = [ "80","443" ] node.default["apache"]["dir"]          = "/etc/apache2" node.default["apache"]["listen_ports"] = [ "80","443" ] node.set['apache2']['proxy_to_unicorn'] = node['rails']['use_unicorn'] normal / set Attribute Precedence The precedence of the attributes is as follows, from low to high: 1. default attributes applied in an attributes file 2. default attributes applied in an environment 3. default attributes applied in a role 4. default attributes applied on a node directly in a recipe 5. normal or set attributes applied in an attributes file 6. normal or set attributes applied on a node directly in a recipe 7. override attributes applied in an attributes file 8. override attributes applied in a role 9. override attributes applied in an environment 10.override attributes applied on a node directly in a recipe 11.automatic attributes generated by Ohai default attributes applied in an attributes file have the lowest priority and automatic attributes generated by Ohai have the highest priority. Write your cookbooks with default attributes, but override these with role-specific or node-specific values as necessary. Wednesday, November 21, 12
  • 17. Working OHAI Ohai detects data about your operating system. It can be used standalone, but its primary purpose is to provide node data to Chef. • When invoked, it collects detailed, extensible information about the machine it's running on, including Chef configuration, hostname, FQDN, networking, memory, CPU, platform, and kernel data. • When used standalone, Ohai will print out a JSON data blob for all the known data about your system. • When used with Chef, that JSON output is reported back via "automatic" node attributes to update the node object on the chef-server. • Ohai plugins provide additional information about your system infrastructure - Custom Ohai Plugin to gather that other information. Wednesday, November 21, 12
  • 18. Jenkins and Branching • Roll forward methodology a rollback is a push forward in version but pervious production push locked branch. • Multiple branches to be compiled • Post Production ( Previous stable push branch) • Pre Production ( Staging 2 push or current push brach ) • Testing ( Smoke testing push in staging 1 ) Wednesday, November 21, 12
  • 19. Continues integration With Chef • Automated Testing and Building Env • Smoke tests on staging 1 environments • Staging 1 one Colo 10% yum repo • Staging 2 multi Colo 50% yum repo • Production 100% yum repo Wednesday, November 21, 12