SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
Automate Your Infrastructure With Chef
             Will Sterling
       Linux & UNIX Consultant
                 @
           PARSEC Group
Agenda
What is Configuration Management?
●




What is Chef?
●




Chef architecture
●




Deploying Chef
●




Deploy Apache onto server using chef
●




                 Automate You Infrastructure With Chef
What is Configuration
                       Management?
Configuration management is a process for
establishing and maintaining consistency of a
product’s performance, functional and physical
attributes with its requirements, design and
operational information throughout its life.
*"MIL-HDBK-61A, ""Military Handbook: Configuration Management Guidance". Department of Defense. 07-
                                                               February-2001. Retrieved 2012-03-24.




                                  Automate You Infrastructure With Chef
CHEF
Configuration Management
●



Infrastructure Automation
●



Open Source
●



Several Deployment Options
●


    ●   Chef Solo
    ●   Open Source Chef Server - Client
    ●   Hosted Chef
    ●   Private Chef

                       Automate You Infrastructure With Chef
Chef Architecture


Server – Client Model
●



Public – Private Key Encryption
●



Servers store the configuration
●



Clients do the work
●



Configuration information shared via Cookbooks
●




               Automate You Infrastructure With Chef
Cookbooks
●Cookbooks are used to distribute configurations
●The Chef community shares cookbooks at

http://communtiy.opscode.com/cookbooks
●Cookbooks contain:

 ● Recipes

 ● Attribute Files

 ● Configuration Artifacts

   ● Templates

   ● Files

   ● Libraries




                Automate You Infrastructure With Chef
Run Lists
         YUM Apache Tomcat
                                   Node1




Server

            YUM MySQL

                                  Node 2




            Automate You Infrastructure With Chef
Roles
         YUM Apache Tomcat
                                  WWW 1
                                   WWW 2
                                     WWW 3
Server

            YUM MySQL

                                  DB 1 1
                                   DB
                                      DB 1




            Automate You Infrastructure With Chef
Sample Recipe
#
# Cookbook Name:: yum
# Recipe:: yum
#
# Copyright 2011, Eric G. Wolfe
# Copyright 2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#


template "/etc/yum.conf" do
  source "yum-rhel#{node[:platform_version].to_i}.conf.erb"
end




                                   Automate You Infrastructure With Chef
Sample Template
# Generated by Chef for <%= node[:fqdn] %>
# Local modifications will be overwritten.
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3
<%- if node[:yum][:exclude] %>
exclude=<%= node[:yum][:exclude].join(" ") %>
<%- end %>
<%- if node[:yum][:installonlypkgs] %>
installonlypkgs=<%= node[:yum][:installonlypkgs].join(" ") %>
<%- end %>



# This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
# It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m



# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d




                                               Automate You Infrastructure With Chef
Installing Chef Server on Ubuntu
1)Add Opscode APT Repository
      1) sudo -s “echo deb http://apt.opscode.com/ lucid-0.10 main >
           /etc/apt/sources.list.d/opscode.list”
      2) sudo mkdir -p /etc/apt/trusted.gpg.d
      3) gpg --keyserver keys.gnupg.net --recv-keys 83EF826A
      4) sudo -s “gpg --export packages@opscode.com > /etc/apt/trusted.gpg.d/opscode-
           keyring.gpg”
      5) sudo apt-get update
      6) sudo apt-get install opscode-keyring
      7) sudo apt-get upgrade
2)Install Chef and Chef Server packages
         1) sudo apt-get install chef chef-server
           1) Follow on screen configuration questions
              1) hostname of server
              2) RabbitMQ queue password
              3) Temporary WebUI admin password
3)Configure CLI
   1) mkdir .chef
   2) sudo cp /etc/chef/validation.pem /etc/chef/webui.pem .chef/
   3) sudo chown -R wills ~/.chef
   4) knife configure -i
         Change path to validation.pem and webui.pem to be /home/user_name/.chef/*.pem.
         Everything else can remain the default.



                          Automate You Infrastructure With Chef
Setup RHEL/Centos Chef Client



chef-client> sudo yum install ruby ruby-devel make gcc
chef-server> knife bootstrap chef-client -i ssh_key
chef-server> knife node list




                  Automate You Infrastructure With Chef
Install Cookbooks
Download Cookbooks from Chef Community,
http://community.opscode.com/cookbooks

 1)chef-server> knife cookbook site download chef-client
 2)chef-server> tar -xzf chef-client*
 3)chef-server> knife cookbook site download apache2
 4)chef-server> tar -xzf apache2*
 5)chef-server> less apache2/README.md
 6)chef-server> knife cookbook site download yum
 7)chef-server> tar -xzf yum*
 8)chef-server> less yum/README.md
 9)chef-server> knife cookbook upload -a -o ./
 10)chef-server> knife cookbook list


                    Automate You Infrastructure With Chef
Create a Run List
1)chef-server> knife node run_list add chef-
 client.parsec.com `chef-client`
2)chef-server> knife node run_list add chef-
 client.parsec.com 'yum'
3)chef-server> knife node run_list add chef-
 client.parsec.com 'yum::epel'
4)chef-client> sudo /usr/bin/chef-client
5)chef-client> sudo chkconfig
6)chef-client> sudo yum repolist

                  Automate You Infrastructure With Chef
Add Apache to Run List
1) chef-server> vi apache2/attributes/default.rb
134
      default['apache']['default_modules'] = %w{
      status alias auth_basic authn_file authz_default authz_groupfile
      authz_host authz_user autoindex dir env mime negotiation setenvif logio
      }

2) chef-server> vi apache2/recipes/mod_logio.rb
      if platform?("redhat", "centos", "scientific", "fedora", "suse", "arch", "freebsd", "amazon")
      apache_module "logio"
      else
       include_recipe "apache2"
      End

3) chef-server> knife node run_list add chef-
 client.parsec.com 'apache2'
4) chef-server> knife cookbook upload apache2
 -o ./
5) chef-client> chef-client

                              Automate You Infrastructure With Chef
Add Our Own HTML Content
 1) chef-server> sudo vi apache2/files/default/index.html
     <HTML><BODY>
           Hello World!
     </BODY></HTML>

 2) chef-server> vi apache2/recipes/default.rb
66
     cookbook_file "/var/www/index.html" do
           source "index.html"
           mode 0755
           owner "root"
           group node[:apache][:root_group]
     end

 3) chef-server> knife cookbook upload apache2 -o ./
 4) chef-client> chef-client


                             Automate You Infrastructure With Chef
Resources


linux@parsec.com
●



http://www.parsec.com
●



http://wiki.opscode.com/
●



http://community.opscode.com/
●



http://community.opscode.com/cookbooks
●




               Automate You Infrastructure With Chef

Contenu connexe

Tendances

Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopLorin Hochstein
 
Infrastructure = Code
Infrastructure = CodeInfrastructure = Code
Infrastructure = CodeGeorg Sorst
 
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOpsОмские ИТ-субботники
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleRobert Reiz
 
Functional Hostnames and Why they are Bad
Functional Hostnames and Why they are BadFunctional Hostnames and Why they are Bad
Functional Hostnames and Why they are BadPuppet
 
Introduction to Oozie | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Oozie | Big Data Hadoop Spark Tutorial | CloudxLabIntroduction to Oozie | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Oozie | Big Data Hadoop Spark Tutorial | CloudxLabCloudxLab
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to AnsibleKnoldus Inc.
 
Compliance as Code
Compliance as CodeCompliance as Code
Compliance as CodeMatt Ray
 
Amazon EC2 Container Service in Action
Amazon EC2 Container Service in ActionAmazon EC2 Container Service in Action
Amazon EC2 Container Service in ActionRemotty
 
Hadoop single cluster installation
Hadoop single cluster installationHadoop single cluster installation
Hadoop single cluster installationMinh Tran
 
Asian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On UblAsian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On Ublnewrforce
 
Powershell dcpp
Powershell dcppPowershell dcpp
Powershell dcppartisriva
 
Testing with Ansible
Testing with AnsibleTesting with Ansible
Testing with AnsibleBas Meijer
 
Replication features, technologies and 3rd party Extinction
Replication features, technologies and 3rd party ExtinctionReplication features, technologies and 3rd party Extinction
Replication features, technologies and 3rd party ExtinctionBen Mildren
 
Automating complex infrastructures with Puppet
Automating complex infrastructures with PuppetAutomating complex infrastructures with Puppet
Automating complex infrastructures with PuppetKris Buytaert
 
Ansible ex407 and EX 294
Ansible ex407 and EX 294Ansible ex407 and EX 294
Ansible ex407 and EX 294IkiArif1
 
CoreOS: Control Your Fleet
CoreOS: Control Your FleetCoreOS: Control Your Fleet
CoreOS: Control Your FleetMatthew Jones
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansibleMukul Malhotra
 

Tendances (20)

Docker up and running
Docker up and runningDocker up and running
Docker up and running
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptop
 
Infrastructure = Code
Infrastructure = CodeInfrastructure = Code
Infrastructure = Code
 
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & Ansible
 
Functional Hostnames and Why they are Bad
Functional Hostnames and Why they are BadFunctional Hostnames and Why they are Bad
Functional Hostnames and Why they are Bad
 
Introduction to Oozie | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Oozie | Big Data Hadoop Spark Tutorial | CloudxLabIntroduction to Oozie | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Oozie | Big Data Hadoop Spark Tutorial | CloudxLab
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
 
Compliance as Code
Compliance as CodeCompliance as Code
Compliance as Code
 
Amazon EC2 Container Service in Action
Amazon EC2 Container Service in ActionAmazon EC2 Container Service in Action
Amazon EC2 Container Service in Action
 
Hadoop single cluster installation
Hadoop single cluster installationHadoop single cluster installation
Hadoop single cluster installation
 
Asian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On UblAsian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On Ubl
 
Powershell dcpp
Powershell dcppPowershell dcpp
Powershell dcpp
 
Testing with Ansible
Testing with AnsibleTesting with Ansible
Testing with Ansible
 
Replication features, technologies and 3rd party Extinction
Replication features, technologies and 3rd party ExtinctionReplication features, technologies and 3rd party Extinction
Replication features, technologies and 3rd party Extinction
 
Automating complex infrastructures with Puppet
Automating complex infrastructures with PuppetAutomating complex infrastructures with Puppet
Automating complex infrastructures with Puppet
 
Sim a Microsoft Utiliza OpenSource em DevOps!
Sim a Microsoft Utiliza OpenSource em DevOps!Sim a Microsoft Utiliza OpenSource em DevOps!
Sim a Microsoft Utiliza OpenSource em DevOps!
 
Ansible ex407 and EX 294
Ansible ex407 and EX 294Ansible ex407 and EX 294
Ansible ex407 and EX 294
 
CoreOS: Control Your Fleet
CoreOS: Control Your FleetCoreOS: Control Your Fleet
CoreOS: Control Your Fleet
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 

En vedette

Velocity2011 chef-workshop
Velocity2011 chef-workshopVelocity2011 chef-workshop
Velocity2011 chef-workshopjtimberman
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to Chefkevsmith
 
Cook Infrastructure with chef -- Justeat.IN
Cook Infrastructure with chef  -- Justeat.INCook Infrastructure with chef  -- Justeat.IN
Cook Infrastructure with chef -- Justeat.INRajesh Hegde
 
Testable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and DockerTestable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and DockerMandi Walls
 
Introducing Chef | An IT automation for speed and awesomeness
Introducing Chef | An IT automation for speed and awesomenessIntroducing Chef | An IT automation for speed and awesomeness
Introducing Chef | An IT automation for speed and awesomenessRamit Surana
 
Overview of chef ( Infrastructure as a Code )
Overview of chef ( Infrastructure as a Code )Overview of chef ( Infrastructure as a Code )
Overview of chef ( Infrastructure as a Code )Pravin Mishra
 
Chef Cookbook Testing and Continuous Integration
Chef Cookbook Testing and Continuous IntegrationChef Cookbook Testing and Continuous Integration
Chef Cookbook Testing and Continuous IntegrationJulian Dunn
 
Introduction to Chef: Automate Your Infrastructure by Modeling It In Code
Introduction to Chef: Automate Your Infrastructure by Modeling It In CodeIntroduction to Chef: Automate Your Infrastructure by Modeling It In Code
Introduction to Chef: Automate Your Infrastructure by Modeling It In CodeJosh Padnick
 
Jenkins and Chef: Infrastructure CI and Automated Deployment
Jenkins and Chef: Infrastructure CI and Automated DeploymentJenkins and Chef: Infrastructure CI and Automated Deployment
Jenkins and Chef: Infrastructure CI and Automated DeploymentDan Stine
 
Infrastructure Automation with Chef
Infrastructure Automation with ChefInfrastructure Automation with Chef
Infrastructure Automation with ChefAdam Jacob
 

En vedette (14)

Velocity2011 chef-workshop
Velocity2011 chef-workshopVelocity2011 chef-workshop
Velocity2011 chef-workshop
 
IT Automation with Chef
IT Automation with ChefIT Automation with Chef
IT Automation with Chef
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to Chef
 
Devops madrid: successful case in AWS
Devops madrid: successful case in AWSDevops madrid: successful case in AWS
Devops madrid: successful case in AWS
 
Cook Infrastructure with chef -- Justeat.IN
Cook Infrastructure with chef  -- Justeat.INCook Infrastructure with chef  -- Justeat.IN
Cook Infrastructure with chef -- Justeat.IN
 
Testable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and DockerTestable Infrastructure with Chef, Test Kitchen, and Docker
Testable Infrastructure with Chef, Test Kitchen, and Docker
 
Lvm advanced topics
Lvm advanced topicsLvm advanced topics
Lvm advanced topics
 
Introducing Chef | An IT automation for speed and awesomeness
Introducing Chef | An IT automation for speed and awesomenessIntroducing Chef | An IT automation for speed and awesomeness
Introducing Chef | An IT automation for speed and awesomeness
 
DevOps and Chef improve your life
DevOps and Chef improve your life DevOps and Chef improve your life
DevOps and Chef improve your life
 
Overview of chef ( Infrastructure as a Code )
Overview of chef ( Infrastructure as a Code )Overview of chef ( Infrastructure as a Code )
Overview of chef ( Infrastructure as a Code )
 
Chef Cookbook Testing and Continuous Integration
Chef Cookbook Testing and Continuous IntegrationChef Cookbook Testing and Continuous Integration
Chef Cookbook Testing and Continuous Integration
 
Introduction to Chef: Automate Your Infrastructure by Modeling It In Code
Introduction to Chef: Automate Your Infrastructure by Modeling It In CodeIntroduction to Chef: Automate Your Infrastructure by Modeling It In Code
Introduction to Chef: Automate Your Infrastructure by Modeling It In Code
 
Jenkins and Chef: Infrastructure CI and Automated Deployment
Jenkins and Chef: Infrastructure CI and Automated DeploymentJenkins and Chef: Infrastructure CI and Automated Deployment
Jenkins and Chef: Infrastructure CI and Automated Deployment
 
Infrastructure Automation with Chef
Infrastructure Automation with ChefInfrastructure Automation with Chef
Infrastructure Automation with Chef
 

Similaire à Chef

Testing your-automation-code (vagrant version) v0.2
Testing your-automation-code (vagrant version) v0.2Testing your-automation-code (vagrant version) v0.2
Testing your-automation-code (vagrant version) v0.2Sylvain Tissot
 
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.
 
DevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of ChefDevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of ChefAntons Kranga
 
Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015Jennifer Davis
 
Testing Your Automation Code (Vagrant Version)
Testing Your Automation Code (Vagrant Version)Testing Your Automation Code (Vagrant Version)
Testing Your Automation Code (Vagrant Version)Mischa Taylor
 
Automating your infrastructure with Chef
Automating your infrastructure with ChefAutomating your infrastructure with Chef
Automating your infrastructure with ChefJohn Ewart
 
Introduction to chef framework
Introduction to chef frameworkIntroduction to chef framework
Introduction to chef frameworkmorgoth
 
Test Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as CodeTest Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as CodeCybera Inc.
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode ChefSri Ram
 
Chef - Infrastructure Automation for the Masses
Chef - Infrastructure Automation for the Masses�Chef - Infrastructure Automation for the Masses�
Chef - Infrastructure Automation for the MassesSai Perchard
 
EC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and PackerEC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and PackerGeorge Miranda
 
What is Chef and how we use it at tripsta
What is Chef and how we use it at tripstaWhat is Chef and how we use it at tripsta
What is Chef and how we use it at tripstaGiedrius Rimkus
 
Chef Provisioning a Chef Server Cluster - ChefConf 2015
Chef Provisioning a Chef Server Cluster - ChefConf 2015Chef Provisioning a Chef Server Cluster - ChefConf 2015
Chef Provisioning a Chef Server Cluster - ChefConf 2015Chef
 
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)Amazon Web Services
 
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
 
Chef, Vagrant and Friends
Chef, Vagrant and FriendsChef, Vagrant and Friends
Chef, Vagrant and FriendsBen McRae
 
CodeFest 2013. Mosesohn M. — Automating environments with Cobbler
CodeFest 2013. Mosesohn M. — Automating environments with CobblerCodeFest 2013. Mosesohn M. — Automating environments with Cobbler
CodeFest 2013. Mosesohn M. — Automating environments with CobblerCodeFest
 

Similaire à Chef (20)

Chef introduction
Chef introductionChef introduction
Chef introduction
 
Testing your-automation-code (vagrant version) v0.2
Testing your-automation-code (vagrant version) v0.2Testing your-automation-code (vagrant version) v0.2
Testing your-automation-code (vagrant version) v0.2
 
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
 
DevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of ChefDevOps hackathon Session 2: Basics of Chef
DevOps hackathon Session 2: Basics of Chef
 
Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015
 
Chef
ChefChef
Chef
 
Testing Your Automation Code (Vagrant Version)
Testing Your Automation Code (Vagrant Version)Testing Your Automation Code (Vagrant Version)
Testing Your Automation Code (Vagrant Version)
 
Automating your infrastructure with Chef
Automating your infrastructure with ChefAutomating your infrastructure with Chef
Automating your infrastructure with Chef
 
Introduction to chef framework
Introduction to chef frameworkIntroduction to chef framework
Introduction to chef framework
 
Test Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as CodeTest Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as Code
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode Chef
 
Chef - Infrastructure Automation for the Masses
Chef - Infrastructure Automation for the Masses�Chef - Infrastructure Automation for the Masses�
Chef - Infrastructure Automation for the Masses
 
EC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and PackerEC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and Packer
 
Understand Chef
Understand ChefUnderstand Chef
Understand Chef
 
What is Chef and how we use it at tripsta
What is Chef and how we use it at tripstaWhat is Chef and how we use it at tripsta
What is Chef and how we use it at tripsta
 
Chef Provisioning a Chef Server Cluster - ChefConf 2015
Chef Provisioning a Chef Server Cluster - ChefConf 2015Chef Provisioning a Chef Server Cluster - ChefConf 2015
Chef Provisioning a Chef Server Cluster - ChefConf 2015
 
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)
 
Automated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. AnsibleAutomated Deployment and Configuration Engines. Ansible
Automated Deployment and Configuration Engines. Ansible
 
Chef, Vagrant and Friends
Chef, Vagrant and FriendsChef, Vagrant and Friends
Chef, Vagrant and Friends
 
CodeFest 2013. Mosesohn M. — Automating environments with Cobbler
CodeFest 2013. Mosesohn M. — Automating environments with CobblerCodeFest 2013. Mosesohn M. — Automating environments with Cobbler
CodeFest 2013. Mosesohn M. — Automating environments with Cobbler
 

Dernier

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
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
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
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
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
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
 
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
 
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
 
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
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 

Dernier (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
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
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
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!
 
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
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
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
 
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)
 
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
 
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
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 

Chef

  • 1. Automate Your Infrastructure With Chef Will Sterling Linux & UNIX Consultant @ PARSEC Group
  • 2. Agenda What is Configuration Management? ● What is Chef? ● Chef architecture ● Deploying Chef ● Deploy Apache onto server using chef ● Automate You Infrastructure With Chef
  • 3. What is Configuration Management? Configuration management is a process for establishing and maintaining consistency of a product’s performance, functional and physical attributes with its requirements, design and operational information throughout its life. *"MIL-HDBK-61A, ""Military Handbook: Configuration Management Guidance". Department of Defense. 07- February-2001. Retrieved 2012-03-24. Automate You Infrastructure With Chef
  • 4. CHEF Configuration Management ● Infrastructure Automation ● Open Source ● Several Deployment Options ● ● Chef Solo ● Open Source Chef Server - Client ● Hosted Chef ● Private Chef Automate You Infrastructure With Chef
  • 5. Chef Architecture Server – Client Model ● Public – Private Key Encryption ● Servers store the configuration ● Clients do the work ● Configuration information shared via Cookbooks ● Automate You Infrastructure With Chef
  • 6. Cookbooks ●Cookbooks are used to distribute configurations ●The Chef community shares cookbooks at http://communtiy.opscode.com/cookbooks ●Cookbooks contain: ● Recipes ● Attribute Files ● Configuration Artifacts ● Templates ● Files ● Libraries Automate You Infrastructure With Chef
  • 7. Run Lists YUM Apache Tomcat Node1 Server YUM MySQL Node 2 Automate You Infrastructure With Chef
  • 8. Roles YUM Apache Tomcat WWW 1 WWW 2 WWW 3 Server YUM MySQL DB 1 1 DB DB 1 Automate You Infrastructure With Chef
  • 9. Sample Recipe # # Cookbook Name:: yum # Recipe:: yum # # Copyright 2011, Eric G. Wolfe # Copyright 2011, Opscode, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # template "/etc/yum.conf" do source "yum-rhel#{node[:platform_version].to_i}.conf.erb" end Automate You Infrastructure With Chef
  • 10. Sample Template # Generated by Chef for <%= node[:fqdn] %> # Local modifications will be overwritten. [main] cachedir=/var/cache/yum/$basearch/$releasever keepcache=0 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 installonly_limit=3 <%- if node[:yum][:exclude] %> exclude=<%= node[:yum][:exclude].join(" ") %> <%- end %> <%- if node[:yum][:installonlypkgs] %> installonlypkgs=<%= node[:yum][:installonlypkgs].join(" ") %> <%- end %> # This is the default, if you make this bigger yum won't see if the metadata # is newer on the remote and so you'll "gain" the bandwidth of not having to # download the new metadata and "pay" for it by yum not having correct # information. # It is esp. important, to have correct metadata, for distributions like # Fedora which don't keep old packages around. If you don't like this checking # interupting your command line usage, it's much better to have something # manually check the metadata once an hour (yum-updatesd will do this). # metadata_expire=90m # PUT YOUR REPOS HERE OR IN separate files named file.repo # in /etc/yum.repos.d Automate You Infrastructure With Chef
  • 11. Installing Chef Server on Ubuntu 1)Add Opscode APT Repository 1) sudo -s “echo deb http://apt.opscode.com/ lucid-0.10 main > /etc/apt/sources.list.d/opscode.list” 2) sudo mkdir -p /etc/apt/trusted.gpg.d 3) gpg --keyserver keys.gnupg.net --recv-keys 83EF826A 4) sudo -s “gpg --export packages@opscode.com > /etc/apt/trusted.gpg.d/opscode- keyring.gpg” 5) sudo apt-get update 6) sudo apt-get install opscode-keyring 7) sudo apt-get upgrade 2)Install Chef and Chef Server packages 1) sudo apt-get install chef chef-server 1) Follow on screen configuration questions 1) hostname of server 2) RabbitMQ queue password 3) Temporary WebUI admin password 3)Configure CLI 1) mkdir .chef 2) sudo cp /etc/chef/validation.pem /etc/chef/webui.pem .chef/ 3) sudo chown -R wills ~/.chef 4) knife configure -i Change path to validation.pem and webui.pem to be /home/user_name/.chef/*.pem. Everything else can remain the default. Automate You Infrastructure With Chef
  • 12. Setup RHEL/Centos Chef Client chef-client> sudo yum install ruby ruby-devel make gcc chef-server> knife bootstrap chef-client -i ssh_key chef-server> knife node list Automate You Infrastructure With Chef
  • 13. Install Cookbooks Download Cookbooks from Chef Community, http://community.opscode.com/cookbooks 1)chef-server> knife cookbook site download chef-client 2)chef-server> tar -xzf chef-client* 3)chef-server> knife cookbook site download apache2 4)chef-server> tar -xzf apache2* 5)chef-server> less apache2/README.md 6)chef-server> knife cookbook site download yum 7)chef-server> tar -xzf yum* 8)chef-server> less yum/README.md 9)chef-server> knife cookbook upload -a -o ./ 10)chef-server> knife cookbook list Automate You Infrastructure With Chef
  • 14. Create a Run List 1)chef-server> knife node run_list add chef- client.parsec.com `chef-client` 2)chef-server> knife node run_list add chef- client.parsec.com 'yum' 3)chef-server> knife node run_list add chef- client.parsec.com 'yum::epel' 4)chef-client> sudo /usr/bin/chef-client 5)chef-client> sudo chkconfig 6)chef-client> sudo yum repolist Automate You Infrastructure With Chef
  • 15. Add Apache to Run List 1) chef-server> vi apache2/attributes/default.rb 134 default['apache']['default_modules'] = %w{ status alias auth_basic authn_file authz_default authz_groupfile authz_host authz_user autoindex dir env mime negotiation setenvif logio } 2) chef-server> vi apache2/recipes/mod_logio.rb if platform?("redhat", "centos", "scientific", "fedora", "suse", "arch", "freebsd", "amazon") apache_module "logio" else include_recipe "apache2" End 3) chef-server> knife node run_list add chef- client.parsec.com 'apache2' 4) chef-server> knife cookbook upload apache2 -o ./ 5) chef-client> chef-client Automate You Infrastructure With Chef
  • 16. Add Our Own HTML Content 1) chef-server> sudo vi apache2/files/default/index.html <HTML><BODY> Hello World! </BODY></HTML> 2) chef-server> vi apache2/recipes/default.rb 66 cookbook_file "/var/www/index.html" do source "index.html" mode 0755 owner "root" group node[:apache][:root_group] end 3) chef-server> knife cookbook upload apache2 -o ./ 4) chef-client> chef-client Automate You Infrastructure With Chef