SlideShare a Scribd company logo
Chef
Introduction and overview to managing your
systems
Adrian Moisey
Why Chef (or puppet or Bcfg2 or
CFEngine)?
- Infrastructure as code
Why Chef (or puppet or Bcfg2 or
CFEngine)?
- Infrastructure as code
- Reproducible
Why Chef (or puppet or Bcfg2 or
CFEngine)?
- Infrastructure as code
- Reproducible
- Version control (SCM)
Why Chef (or puppet or Bcfg2 or
CFEngine)?
- Infrastructure as code
- Reproducible
- Version control (SCM)
- Removes the human factor
Why Chef (or puppet or Bcfg2 or
CFEngine)?
- Infrastructure as code
- Reproducible
- Version control (SCM)
- Removes the human factor
- Tests
Basic Chef Architecture
- Executes various "recipes" which configure
your system in the desired way
Basic Chef Architecture
- Executes various "recipes" which configure
your system in the desired way
- A node definition is required in order for chef
to know which recipes to run and with which
attributes to run them
Basic Chef Architecture
- Executes various "recipes" which configure
your system in the desired way
- A node definition is required in order for chef
to know which recipes to run and with which
attributes to run them
- Allows you to decide what and how
components are configured using attributes,
environment definitions and node definitions.
Basic Chef Architecture
Server/client:
- chef-server stores all your cookbooks,
environments, roles and nodes
Basic Chef Architecture
Server/client:
- chef-server stores all your cookbooks,
environments, roles and nodes
- chef-client connects and gets given the
relevant cookbooks and attributes from chef-
server and executes them
Basic Chef Architecture
Server/client:
- chef-server stores all your cookbooks,
environments, roles and nodes
- chef-client connects and gets given the
relevant cookbooks and attributes from chef-
server and executes them
You can run your own server or use the
opscode hosted chef (for a fee)
Basic Chef Architecture
Chef-solo:
- Standalone, doesn't connect to a server
Basic Chef Architecture
Chef-solo:
- Standalone, doesn't connect to a server
- Uses static cookbooks and nodes on the local
filesystem
Basic Chef Architecture
Chef-solo:
- Standalone, doesn't connect to a server
- Uses static cookbooks and nodes on the local
filesystem
- Unable to perform searches (because nodes
are stand-alone with no central directory)
Cookbook
From the wiki:
A cookbook is the fundamental unit of
configuration and policy distribution in Chef.
Each cookbook defines a scenario, such as
everything needed to install and configure
MySQL, and then it contains all of the
components that are required to support that
scenario.
Cookbook
Can contain:
- recipes
- attributes
- providers
- definitions
- templates
- files
- metadata
http://docs.opscode.
com/essentials_cookbooks.html
Cookbook
$ cat cookbooks/ntp/recipe/default.rb
['openntpd','ntpdate'].each do |p|
package p do
action :install
end
end
template 'ntpd.conf' do
path '/etc/openntpd/ntpd.conf'
source 'ntpd.conf.erb'
owner 'root'
group 'root'
mode 0600
notifies :restart, 'service[openntpd]'
end
Cookbook
$ cat cookbooks/ntp/attributes/default.rb
default[:ntp][:servers] = [
"0.pool.ntp.org",
"1.pool.ntp.org",
"2.pool.ntp.org",
"3.pool.ntp.org"
]
Role
$ cat roles/ntp.rb
name "ntp"
description "Install openntpd"
run_list("recipe[ntp]")
Environment
$ cat environments/cluster01.rb
name "cluster01"
description "Cluster 01"
default_attributes({
:ntp => {
:servers => [
"ntp01.mycorp.com",
"ntp02.mycorp.com"
]
}
})
cookbook_versions({
"ntp" => "0.0.1"
})
Nodes
$ cat nodes/server01.mycorp.com.json
{
"chef_type": "node",
"name": "server01.mycorp.com",
"normal": {},
"default": {},
"chef_environment": "cluster01",
"run_list": [ "role[ntp]" ],
"override": {},
"json_class": "Chef::Node",
"automatic": {}
}
Knife
Knife is a command-line tool that provides an
interface between a local Chef repository and
the Chef Server.
Examples:
knife cookbook upload apache2
knife node edit web1.mycorp.com
knife list clients
knife search node 'role:web' -a fqdn
Upload all of this to the chef-server
$ knife cookbook upload ntp -o cookbooks/
$ knife role from file roles/ntp.rb
$ knife environment from file environment/cluster01.rb
Data bags
- global variable
- stored in JSON
- accessible from the chef server
- can be searched
- can also be encrypted
For example: to store all your users
Community cookbooks
https://github.com/opscode-cookbooks/
apache, chef-server, chef-client, mysql, build-
essential, cron, php, nagios, logrotate, erlang,
python, jenkins, squid, iptables, samba,
unicorn, munin, jira, screen, tftp
Community cookbooks - tips
- Use the community cookbooks unmodified
Community cookbooks - tips
- Use the community cookbooks unmodified
- Write wrapper cookbooks around them - most
of them were designed with this in mind
Community cookbooks - tips
- Use the community cookbooks unmodified
- Write wrapper cookbooks around them - most
of them were designed with this in mind
- Send bug fixes upstream
Cookbook versioning
- Cookbooks can contain versions
Cookbook versioning
- Cookbooks can contain versions
- Cookbooks can depend on specific versions
of other cookbooks
Cookbook versioning
- Cookbooks can contain versions
- Cookbooks can depend on specific versions
of other cookbooks
- Different environments can depend on
different versions of cookbooks (allows you to
have 0.0.2 in testing and 0.0.1 in production)
Tests
- foodcritic: linting tool which checks against a
community list of rules
Tests
- foodcritic: linting tool which checks against a
community list of rules
- chef-spec: unit tests for recipe code (not
functional)
Tests
- foodcritic: linting tool which checks against a
community list of rules
- chef-spec: unit tests for recipe code (not
functional)
- test-kitchen: Framework for running
integration tests in an isolated environment (<3
vagrant)
Live demo!
- Remove a Yola employee
- Create a pull request
- Push it to the chef-server
- Ensure that it has been done
- Take a look at some things that knife can do
Some cool things
- chef-solo can run the chef-server cookbook in
order to bootstrap your chef-server
- knife ec2 allows you to create an EC2
instance and configure it as a chef-client
The End
Questions?
Thanks to Jonathan for help with the slides

More Related Content

PDF
Chef
Juri Timošin
 
KEY
Cooking with Chef
Ken Robertson
 
PDF
Automating your infrastructure with Chef
John Ewart
 
PPTX
Chef introduction
FENG Zhichao
 
PPT
Chef, Devops, and You
Bryan Berry
 
PDF
Chef Fundamentals Training Series Module 2: Workstation Setup
Chef Software, Inc.
 
PPTX
Cook Infrastructure with chef -- Justeat.IN
Rajesh Hegde
 
PDF
Atmosphere 2014: Really large scale systems configuration - Phil Dibowitz
PROIDEA
 
Cooking with Chef
Ken Robertson
 
Automating your infrastructure with Chef
John Ewart
 
Chef introduction
FENG Zhichao
 
Chef, Devops, and You
Bryan Berry
 
Chef Fundamentals Training Series Module 2: Workstation Setup
Chef Software, Inc.
 
Cook Infrastructure with chef -- Justeat.IN
Rajesh Hegde
 
Atmosphere 2014: Really large scale systems configuration - Phil Dibowitz
PROIDEA
 

What's hot (20)

PDF
Server Installation and Configuration with Chef
Raimonds Simanovskis
 
PDF
IT Automation with Chef
Anuchit Chalothorn
 
PDF
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
Chef Software, Inc.
 
ODP
Introduction to Chef
Knoldus Inc.
 
PPTX
Monitoring and tuning your chef server - chef conf talk
Andrew DuFour
 
PDF
Ansible 2 and Ansible Galaxy 2
Jeff Geerling
 
PDF
Introduction to chef framework
morgoth
 
PDF
Chef conf-2014
Jamie Winsor
 
PDF
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
Chef Software, Inc.
 
PPTX
Infrastructure Automation with Chef & Ansible
wajrcs
 
PDF
The unintended benefits of Chef
Chef Software, Inc.
 
ODP
Chef training - Day2
Andriy Samilyak
 
PPTX
Opscode Webinar: Managing Your VMware Infrastructure with Chef
Chef Software, Inc.
 
PDF
Infrastructure Automation with Chef
Jonathan Weiss
 
PPTX
Sim a Microsoft Utiliza OpenSource em DevOps!
Vinícius Batista de Souza
 
PPTX
Understand Chef
devopsjourney
 
PPTX
Introduction to chef
Damith Kothalawala
 
PDF
Chef: Smart infrastructure automation
Johannes H. P. Skov Frandsen
 
PDF
CHEF - by Scott Russel
Kangaroot
 
PDF
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Software, Inc.
 
Server Installation and Configuration with Chef
Raimonds Simanovskis
 
IT Automation with Chef
Anuchit Chalothorn
 
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
Chef Software, Inc.
 
Introduction to Chef
Knoldus Inc.
 
Monitoring and tuning your chef server - chef conf talk
Andrew DuFour
 
Ansible 2 and Ansible Galaxy 2
Jeff Geerling
 
Introduction to chef framework
morgoth
 
Chef conf-2014
Jamie Winsor
 
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
Chef Software, Inc.
 
Infrastructure Automation with Chef & Ansible
wajrcs
 
The unintended benefits of Chef
Chef Software, Inc.
 
Chef training - Day2
Andriy Samilyak
 
Opscode Webinar: Managing Your VMware Infrastructure with Chef
Chef Software, Inc.
 
Infrastructure Automation with Chef
Jonathan Weiss
 
Sim a Microsoft Utiliza OpenSource em DevOps!
Vinícius Batista de Souza
 
Understand Chef
devopsjourney
 
Introduction to chef
Damith Kothalawala
 
Chef: Smart infrastructure automation
Johannes H. P. Skov Frandsen
 
CHEF - by Scott Russel
Kangaroot
 
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Software, Inc.
 
Ad

Similar to Chef (20)

PDF
Introduction to Cooking with Chef
John Osborne
 
PDF
What is Chef and how we use it at tripsta
Giedrius Rimkus
 
PDF
Introduction to Chef
kevsmith
 
PDF
Chef
Will Sterling
 
PDF
Introduction to Chef: Automate Your Infrastructure by Modeling It In Code
Josh Padnick
 
PDF
Introduction to Chef
Pubudu Suharshan Perera
 
PDF
OSDC 2013 | Introduction into Chef by Andy Hawkins
NETWAYS
 
PDF
Node setup, resource, and recipes - Fundamentals Webinar Series Part 2
Chef
 
PPTX
Kickstarter - Chef Opswork
Hamza Waqas
 
PDF
Chef - industrialize and automate your infrastructure
Michaël Lopez
 
PPTX
Chef Tutorial | Chef Tutorial For Beginners | DevOps Chef Tutorial | DevOps T...
Simplilearn
 
PDF
Cook like a Chef
Ian Yang
 
PDF
TXLF: Chef- Software Defined Infrastructure Today & Tomorrow
Matt Ray
 
PDF
Chef Intro @ SF Bay Area LSPE meetup
Promet Source
 
PPTX
Chef for Openstack
Mohit Sethi
 
PDF
Introduction to Chef - Techsuperwomen Summit
Jennifer Davis
 
PPT
Managing Servers with Chef
Joe Kepley
 
PDF
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Software, Inc.
 
PPTX
Chef fundamentals
Ygor Nascimento
 
Introduction to Cooking with Chef
John Osborne
 
What is Chef and how we use it at tripsta
Giedrius Rimkus
 
Introduction to Chef
kevsmith
 
Introduction to Chef: Automate Your Infrastructure by Modeling It In Code
Josh Padnick
 
Introduction to Chef
Pubudu Suharshan Perera
 
OSDC 2013 | Introduction into Chef by Andy Hawkins
NETWAYS
 
Node setup, resource, and recipes - Fundamentals Webinar Series Part 2
Chef
 
Kickstarter - Chef Opswork
Hamza Waqas
 
Chef - industrialize and automate your infrastructure
Michaël Lopez
 
Chef Tutorial | Chef Tutorial For Beginners | DevOps Chef Tutorial | DevOps T...
Simplilearn
 
Cook like a Chef
Ian Yang
 
TXLF: Chef- Software Defined Infrastructure Today & Tomorrow
Matt Ray
 
Chef Intro @ SF Bay Area LSPE meetup
Promet Source
 
Chef for Openstack
Mohit Sethi
 
Introduction to Chef - Techsuperwomen Summit
Jennifer Davis
 
Managing Servers with Chef
Joe Kepley
 
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Software, Inc.
 
Chef fundamentals
Ygor Nascimento
 
Ad

Recently uploaded (20)

PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
REPORT: Heating appliances market in Poland 2024
SPIUG
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
The Future of Artificial Intelligence (AI)
Mukul
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
REPORT: Heating appliances market in Poland 2024
SPIUG
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 

Chef

  • 1. Chef Introduction and overview to managing your systems Adrian Moisey
  • 2. Why Chef (or puppet or Bcfg2 or CFEngine)? - Infrastructure as code
  • 3. Why Chef (or puppet or Bcfg2 or CFEngine)? - Infrastructure as code - Reproducible
  • 4. Why Chef (or puppet or Bcfg2 or CFEngine)? - Infrastructure as code - Reproducible - Version control (SCM)
  • 5. Why Chef (or puppet or Bcfg2 or CFEngine)? - Infrastructure as code - Reproducible - Version control (SCM) - Removes the human factor
  • 6. Why Chef (or puppet or Bcfg2 or CFEngine)? - Infrastructure as code - Reproducible - Version control (SCM) - Removes the human factor - Tests
  • 7. Basic Chef Architecture - Executes various "recipes" which configure your system in the desired way
  • 8. Basic Chef Architecture - Executes various "recipes" which configure your system in the desired way - A node definition is required in order for chef to know which recipes to run and with which attributes to run them
  • 9. Basic Chef Architecture - Executes various "recipes" which configure your system in the desired way - A node definition is required in order for chef to know which recipes to run and with which attributes to run them - Allows you to decide what and how components are configured using attributes, environment definitions and node definitions.
  • 10. Basic Chef Architecture Server/client: - chef-server stores all your cookbooks, environments, roles and nodes
  • 11. Basic Chef Architecture Server/client: - chef-server stores all your cookbooks, environments, roles and nodes - chef-client connects and gets given the relevant cookbooks and attributes from chef- server and executes them
  • 12. Basic Chef Architecture Server/client: - chef-server stores all your cookbooks, environments, roles and nodes - chef-client connects and gets given the relevant cookbooks and attributes from chef- server and executes them You can run your own server or use the opscode hosted chef (for a fee)
  • 13. Basic Chef Architecture Chef-solo: - Standalone, doesn't connect to a server
  • 14. Basic Chef Architecture Chef-solo: - Standalone, doesn't connect to a server - Uses static cookbooks and nodes on the local filesystem
  • 15. Basic Chef Architecture Chef-solo: - Standalone, doesn't connect to a server - Uses static cookbooks and nodes on the local filesystem - Unable to perform searches (because nodes are stand-alone with no central directory)
  • 16. Cookbook From the wiki: A cookbook is the fundamental unit of configuration and policy distribution in Chef. Each cookbook defines a scenario, such as everything needed to install and configure MySQL, and then it contains all of the components that are required to support that scenario.
  • 17. Cookbook Can contain: - recipes - attributes - providers - definitions - templates - files - metadata http://docs.opscode. com/essentials_cookbooks.html
  • 18. Cookbook $ cat cookbooks/ntp/recipe/default.rb ['openntpd','ntpdate'].each do |p| package p do action :install end end template 'ntpd.conf' do path '/etc/openntpd/ntpd.conf' source 'ntpd.conf.erb' owner 'root' group 'root' mode 0600 notifies :restart, 'service[openntpd]' end
  • 19. Cookbook $ cat cookbooks/ntp/attributes/default.rb default[:ntp][:servers] = [ "0.pool.ntp.org", "1.pool.ntp.org", "2.pool.ntp.org", "3.pool.ntp.org" ]
  • 20. Role $ cat roles/ntp.rb name "ntp" description "Install openntpd" run_list("recipe[ntp]")
  • 21. Environment $ cat environments/cluster01.rb name "cluster01" description "Cluster 01" default_attributes({ :ntp => { :servers => [ "ntp01.mycorp.com", "ntp02.mycorp.com" ] } }) cookbook_versions({ "ntp" => "0.0.1" })
  • 22. Nodes $ cat nodes/server01.mycorp.com.json { "chef_type": "node", "name": "server01.mycorp.com", "normal": {}, "default": {}, "chef_environment": "cluster01", "run_list": [ "role[ntp]" ], "override": {}, "json_class": "Chef::Node", "automatic": {} }
  • 23. Knife Knife is a command-line tool that provides an interface between a local Chef repository and the Chef Server. Examples: knife cookbook upload apache2 knife node edit web1.mycorp.com knife list clients knife search node 'role:web' -a fqdn
  • 24. Upload all of this to the chef-server $ knife cookbook upload ntp -o cookbooks/ $ knife role from file roles/ntp.rb $ knife environment from file environment/cluster01.rb
  • 25. Data bags - global variable - stored in JSON - accessible from the chef server - can be searched - can also be encrypted For example: to store all your users
  • 26. Community cookbooks https://github.com/opscode-cookbooks/ apache, chef-server, chef-client, mysql, build- essential, cron, php, nagios, logrotate, erlang, python, jenkins, squid, iptables, samba, unicorn, munin, jira, screen, tftp
  • 27. Community cookbooks - tips - Use the community cookbooks unmodified
  • 28. Community cookbooks - tips - Use the community cookbooks unmodified - Write wrapper cookbooks around them - most of them were designed with this in mind
  • 29. Community cookbooks - tips - Use the community cookbooks unmodified - Write wrapper cookbooks around them - most of them were designed with this in mind - Send bug fixes upstream
  • 30. Cookbook versioning - Cookbooks can contain versions
  • 31. Cookbook versioning - Cookbooks can contain versions - Cookbooks can depend on specific versions of other cookbooks
  • 32. Cookbook versioning - Cookbooks can contain versions - Cookbooks can depend on specific versions of other cookbooks - Different environments can depend on different versions of cookbooks (allows you to have 0.0.2 in testing and 0.0.1 in production)
  • 33. Tests - foodcritic: linting tool which checks against a community list of rules
  • 34. Tests - foodcritic: linting tool which checks against a community list of rules - chef-spec: unit tests for recipe code (not functional)
  • 35. Tests - foodcritic: linting tool which checks against a community list of rules - chef-spec: unit tests for recipe code (not functional) - test-kitchen: Framework for running integration tests in an isolated environment (<3 vagrant)
  • 36. Live demo! - Remove a Yola employee - Create a pull request - Push it to the chef-server - Ensure that it has been done - Take a look at some things that knife can do
  • 37. Some cool things - chef-solo can run the chef-server cookbook in order to bootstrap your chef-server - knife ec2 allows you to create an EC2 instance and configure it as a chef-client
  • 38. The End Questions? Thanks to Jonathan for help with the slides