SlideShare a Scribd company logo
1 of 22
Michael Richardson
Email: michael@energizedwork.com
2© 2011 Energized Work - www.energizedwork.com
Agenda
Chef Architecture
• Chef Server
• Chef Client
• Web UI
• Chef Solo
• Knife
Chef Basics
• Cookbooks
• Nodes
• Roles
• Attributes
Examples
Useful links
3© 2011 Energized Work - www.energizedwork.com
Chef Architecture
4© 2011 Energized Work - www.energizedwork.com
Chef Server – Architecture
5© 2011 Energized Work - www.energizedwork.com
Server components:
• Chef Server
• Chef Server Web UI
• CouchDB
• RabbitMQ
• Chef Solr Indexer
• Chef Solr
Client components:
• Chef Client
• Chef Solo
• Knife
• Shef
Chef Server
• Merb Web application
• API service
• Data stored with CouchDB
• Distributes cookbooks to Chef Clients
6© 2011 Energized Work - www.energizedwork.com
Chef Server Web UI
• Merb Web application
• Talks to Chef Server API service
• Data stored with CouchDB
7© 2011 Energized Work - www.energizedwork.com
Knife
• Command line interface to Chef
• Alternative to using the Chef-Server Web UI
• Allows you to create, list, edit and delete objects in Chef-Server
8© 2011 Energized Work - www.energizedwork.com
Chef Client
• Clients do all the work
• Communicates with Chef Server via REST
• Downloads, Compiles and Executes cookbooks
• Can run periodically as a daemon or as a single run
• Ohai (part of chef-client). Provides node information to Chef
9© 2011 Energized Work - www.energizedwork.com
Chef Basics
10© 2011 Energized Work - www.energizedwork.com
Nodes
• A node is a host that runs chef client
• Primary feature of a node are it’s attributes and it’s run list
• Nodes are made up of two prime components
• Recipes
• Roles
11© 2011 Energized Work - www.energizedwork.com
Nodes – Run List
• Run list is a list of the recipes that a node will run
• Order is important
• Can include roles which may have recipes assigned to them
12© 2011 Energized Work - www.energizedwork.com
Attributes
• Nodes and roles have associated attributes (key-value pairs)
• Node and role attributes are used as inputs for resource attributes
• Attributes maybe set on a node from the following objects
• Cookbooks
• Roles
• Nodes
13© 2011 Energized Work - www.energizedwork.com
Roles
• Compose functionality sets for nodes through recipes and attributes
• 2 workflows for managing roles
• Write Ruby or JSON files
• Use Knife or Web UI
14© 2011 Energized Work - www.energizedwork.com
Cookbooks
• Collection of files used to configure a system
/cookbook/
/attributes/
/definitions/
/files/
/libraries/
/metadata.rb
/README.rdoc
/recipes/
/templates/
• Each cookbook typically configures a single package of service
• Cookbooks are commonly shared in the Chef community
15© 2011 Energized Work - www.energizedwork.com
Cookbooks – Recipes
• Encapsulates resources (fundamental units in Chef)
• Resource:
16© 2011 Energized Work - www.energizedwork.com
Cookbooks – Recipes
• Basic examples of resources
17© 2011 Energized Work - www.energizedwork.com
package "tar" do
version "1.16.1-1"
action :install
end
remote_file "/tmp/testfile" do
source "http://build.ew/warfiles/testfile"
mode "0644"
checksum "08da002l"
end
service ”httpd" do
supports :status => true, :restart => true, :reload => true
action [ :enable, :start ]
end
cookbook_file "/tmp/testfile" do
source "testfile"
mode "0644"
end
directory "/tmp/something" do
owner "root"
group "root"
mode "0755"
action :create
end
template "/tmp/config.conf" do
source "config.conf.erb"
end
link "/tmp/passwd" do
to "/etc/passwd"
end
Cookbooks – Files and templates
• Files allow you to distribute files to your servers as part of cookbooks
• Templates are files that have been marked up to include variables
• To allow cookbooks to operate on multiple platforms, files and
templates can be found in a number of locations within a cookbook
18© 2011 Energized Work - www.energizedwork.com
Eg in order of priority.
cookbook/templates/webapp01.ew/sudoers.erb
cookbook/templates/ubuntu-8.04/sudoers.erb
cookbook/templates/ubuntu/sudoers.erb
cookbook/templates/default/sudoers.erb
Cookbooks – Template example
• Simple template resource
• Simple ERB template file – templates/default/foo.erb
• Rendered file on client
19© 2011 Energized Work - www.energizedwork.com
node[:fqdn] = ”webapp01.ew"
template "/tmp/foo" do
source "foo.erb"
variables({
:java_app => ”SomethingCool.war"
})
end
The node <%= node[:fqdn] %> is running the app <%= @java_app %>
# cat /tmp/foo
The node webapp01.ew is running the app SomethingCool.war
#
Useful links
• http://www.opscode.com/
• http://wiki.opscode.com/display/chef/Home
• http://wiki.opscode.com/display/chef/Resources
• http://cookbooks.opscode.com/
• https://github.com/37signals/37s_cookbooks
• https://github.com/opscode/cookbooks
20© 2011 Energized Work - www.energizedwork.com
Chef Examples
21© 2011 Energized Work - www.energizedwork.com
22© 2011 Energized Work - www.energizedwork.com
Thank you
Email: michael@energizedwork.com

More Related Content

What's hot

Managing Servers with Chef
Managing Servers with ChefManaging Servers with Chef
Managing Servers with Chef
Joe Kepley
 
Apache Ambari - What's New in 1.2.3
Apache Ambari - What's New in 1.2.3Apache Ambari - What's New in 1.2.3
Apache Ambari - What's New in 1.2.3
Hortonworks
 

What's hot (20)

Automating your infrastructure with Chef
Automating your infrastructure with ChefAutomating your infrastructure with Chef
Automating your infrastructure with Chef
 
Chef fundamentals
Chef fundamentalsChef fundamentals
Chef fundamentals
 
Chef in a nutshell
Chef in a nutshellChef in a nutshell
Chef in a nutshell
 
Infrastructure Automation with Chef
Infrastructure Automation with Chef Infrastructure Automation with Chef
Infrastructure Automation with Chef
 
Managing Servers with Chef
Managing Servers with ChefManaging Servers with Chef
Managing Servers with Chef
 
Chef - Administration for programmers
Chef - Administration for programmersChef - Administration for programmers
Chef - Administration for programmers
 
Chef Tutorial for DEVOPS Newbies
Chef Tutorial for DEVOPS NewbiesChef Tutorial for DEVOPS Newbies
Chef Tutorial for DEVOPS Newbies
 
Overview of Chef - Fundamentals Webinar Series Part 1
Overview of Chef - Fundamentals Webinar Series Part 1Overview of Chef - Fundamentals Webinar Series Part 1
Overview of Chef - Fundamentals Webinar Series Part 1
 
Apache Ambari - What's New in 1.2.3
Apache Ambari - What's New in 1.2.3Apache Ambari - What's New in 1.2.3
Apache Ambari - What's New in 1.2.3
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
Velocity2011 chef-workshop
Velocity2011 chef-workshopVelocity2011 chef-workshop
Velocity2011 chef-workshop
 
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
 
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 )
 
Growing Pains with Chef – a Tale of DevOps in a Large Organization
Growing Pains with Chef – a Tale of DevOps in a Large OrganizationGrowing Pains with Chef – a Tale of DevOps in a Large Organization
Growing Pains with Chef – a Tale of DevOps in a Large Organization
 
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
 
Spring Cloud Config
Spring Cloud ConfigSpring Cloud Config
Spring Cloud Config
 
Chef
ChefChef
Chef
 
There and Back Again: How We Drank the Chef Kool-Aid, Sobered Up, and Learned...
There and Back Again: How We Drank the Chef Kool-Aid, Sobered Up, and Learned...There and Back Again: How We Drank the Chef Kool-Aid, Sobered Up, and Learned...
There and Back Again: How We Drank the Chef Kool-Aid, Sobered Up, and Learned...
 
Rails Engine Patterns
Rails Engine PatternsRails Engine Patterns
Rails Engine Patterns
 
Sitecore sxa best practices and secrets 29th june 2021
Sitecore sxa best practices and secrets   29th june 2021Sitecore sxa best practices and secrets   29th june 2021
Sitecore sxa best practices and secrets 29th june 2021
 

Viewers also liked

Viewers also liked (6)

Docker Service Registration and Discovery
Docker Service Registration and DiscoveryDocker Service Registration and Discovery
Docker Service Registration and Discovery
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
 
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
 
bootstrapping containers with confd
bootstrapping containers with confdbootstrapping containers with confd
bootstrapping containers with confd
 
Persistence in the cloud with bosh
Persistence in the cloud with boshPersistence in the cloud with bosh
Persistence in the cloud with bosh
 

Similar to Chef - managing yours servers with Code

Chef Intro @ SF Bay Area LSPE meetup
Chef Intro @ SF Bay Area LSPE meetupChef Intro @ SF Bay Area LSPE meetup
Chef Intro @ SF Bay Area LSPE meetup
Promet Source
 
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of ChefChef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Software, Inc.
 
Jasig rubyon rails
Jasig rubyon railsJasig rubyon rails
Jasig rubyon rails
_zaMmer_
 
Jasig rubyon rails
Jasig rubyon railsJasig rubyon rails
Jasig rubyon rails
_zaMmer_
 
SharePoint 2014: Where to save my data, for devs!
SharePoint 2014: Where to save my data, for devs!SharePoint 2014: Where to save my data, for devs!
SharePoint 2014: Where to save my data, for devs!
Ben Steinhauser
 

Similar to Chef - managing yours servers with Code (20)

Chef Intro @ SF Bay Area LSPE meetup
Chef Intro @ SF Bay Area LSPE meetupChef Intro @ SF Bay Area LSPE meetup
Chef Intro @ SF Bay Area LSPE meetup
 
Chef for openstack
Chef for openstackChef for openstack
Chef for openstack
 
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of ChefChef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of Chef
 
Introduction to Cooking with Chef
Introduction to Cooking with ChefIntroduction to Cooking with Chef
Introduction to Cooking with Chef
 
CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks
CIRCUIT 2015 - AEM Infrastructure Automation with Chef CookbooksCIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks
CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks
 
Chef Cookbook Design Patterns
Chef Cookbook Design PatternsChef Cookbook Design Patterns
Chef Cookbook Design Patterns
 
TXLF: Chef- Software Defined Infrastructure Today & Tomorrow
TXLF: Chef- Software Defined Infrastructure Today & TomorrowTXLF: Chef- Software Defined Infrastructure Today & Tomorrow
TXLF: Chef- Software Defined Infrastructure Today & Tomorrow
 
Chef - Infrastructure Automation for the Masses
Chef - Infrastructure Automation for the Masses�Chef - Infrastructure Automation for the Masses�
Chef - Infrastructure Automation for the Masses
 
Infrastructure modeling with chef
Infrastructure modeling with chefInfrastructure modeling with chef
Infrastructure modeling with chef
 
Chef conf-2015-chef-patterns-at-bloomberg-scale
Chef conf-2015-chef-patterns-at-bloomberg-scaleChef conf-2015-chef-patterns-at-bloomberg-scale
Chef conf-2015-chef-patterns-at-bloomberg-scale
 
Using Nagios with Chef
Using Nagios with ChefUsing Nagios with Chef
Using Nagios with Chef
 
Jasig rubyon rails
Jasig rubyon railsJasig rubyon rails
Jasig rubyon rails
 
Jasig rubyon rails
Jasig rubyon railsJasig rubyon rails
Jasig rubyon rails
 
Chef Cookbook Workflow
Chef Cookbook WorkflowChef Cookbook Workflow
Chef Cookbook Workflow
 
Configuration management with Chef
Configuration management with ChefConfiguration management with Chef
Configuration management with Chef
 
SharePoint 2014: Where to save my data, for devs!
SharePoint 2014: Where to save my data, for devs!SharePoint 2014: Where to save my data, for devs!
SharePoint 2014: Where to save my data, for devs!
 
Chef
ChefChef
Chef
 
Angular js 1.0-fundamentals
Angular js 1.0-fundamentalsAngular js 1.0-fundamentals
Angular js 1.0-fundamentals
 
Chef: Smart infrastructure automation
Chef: Smart infrastructure automationChef: Smart infrastructure automation
Chef: Smart infrastructure automation
 
2015 08-11-scdo-meetup
2015 08-11-scdo-meetup2015 08-11-scdo-meetup
2015 08-11-scdo-meetup
 

More from m_richardson (6)

Puppetcamp Melbourne - puppetdb
Puppetcamp Melbourne - puppetdbPuppetcamp Melbourne - puppetdb
Puppetcamp Melbourne - puppetdb
 
Node collaboration - sharing information between your systems
Node collaboration - sharing information between your systemsNode collaboration - sharing information between your systems
Node collaboration - sharing information between your systems
 
Node collaboration - Exported Resources and PuppetDB
Node collaboration - Exported Resources and PuppetDBNode collaboration - Exported Resources and PuppetDB
Node collaboration - Exported Resources and PuppetDB
 
Serverspec and Sensu - Testing and Monitoring collide
Serverspec and Sensu - Testing and Monitoring collideServerspec and Sensu - Testing and Monitoring collide
Serverspec and Sensu - Testing and Monitoring collide
 
System Availability Talk
System Availability TalkSystem Availability Talk
System Availability Talk
 
Open Source Monitoring Tools
Open Source Monitoring ToolsOpen Source Monitoring Tools
Open Source Monitoring Tools
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
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
Enterprise Knowledge
 

Recently uploaded (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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
 

Chef - managing yours servers with Code

  • 1.
  • 2. Michael Richardson Email: michael@energizedwork.com 2© 2011 Energized Work - www.energizedwork.com
  • 3. Agenda Chef Architecture • Chef Server • Chef Client • Web UI • Chef Solo • Knife Chef Basics • Cookbooks • Nodes • Roles • Attributes Examples Useful links 3© 2011 Energized Work - www.energizedwork.com
  • 4. Chef Architecture 4© 2011 Energized Work - www.energizedwork.com
  • 5. Chef Server – Architecture 5© 2011 Energized Work - www.energizedwork.com Server components: • Chef Server • Chef Server Web UI • CouchDB • RabbitMQ • Chef Solr Indexer • Chef Solr Client components: • Chef Client • Chef Solo • Knife • Shef
  • 6. Chef Server • Merb Web application • API service • Data stored with CouchDB • Distributes cookbooks to Chef Clients 6© 2011 Energized Work - www.energizedwork.com
  • 7. Chef Server Web UI • Merb Web application • Talks to Chef Server API service • Data stored with CouchDB 7© 2011 Energized Work - www.energizedwork.com
  • 8. Knife • Command line interface to Chef • Alternative to using the Chef-Server Web UI • Allows you to create, list, edit and delete objects in Chef-Server 8© 2011 Energized Work - www.energizedwork.com
  • 9. Chef Client • Clients do all the work • Communicates with Chef Server via REST • Downloads, Compiles and Executes cookbooks • Can run periodically as a daemon or as a single run • Ohai (part of chef-client). Provides node information to Chef 9© 2011 Energized Work - www.energizedwork.com
  • 10. Chef Basics 10© 2011 Energized Work - www.energizedwork.com
  • 11. Nodes • A node is a host that runs chef client • Primary feature of a node are it’s attributes and it’s run list • Nodes are made up of two prime components • Recipes • Roles 11© 2011 Energized Work - www.energizedwork.com
  • 12. Nodes – Run List • Run list is a list of the recipes that a node will run • Order is important • Can include roles which may have recipes assigned to them 12© 2011 Energized Work - www.energizedwork.com
  • 13. Attributes • Nodes and roles have associated attributes (key-value pairs) • Node and role attributes are used as inputs for resource attributes • Attributes maybe set on a node from the following objects • Cookbooks • Roles • Nodes 13© 2011 Energized Work - www.energizedwork.com
  • 14. Roles • Compose functionality sets for nodes through recipes and attributes • 2 workflows for managing roles • Write Ruby or JSON files • Use Knife or Web UI 14© 2011 Energized Work - www.energizedwork.com
  • 15. Cookbooks • Collection of files used to configure a system /cookbook/ /attributes/ /definitions/ /files/ /libraries/ /metadata.rb /README.rdoc /recipes/ /templates/ • Each cookbook typically configures a single package of service • Cookbooks are commonly shared in the Chef community 15© 2011 Energized Work - www.energizedwork.com
  • 16. Cookbooks – Recipes • Encapsulates resources (fundamental units in Chef) • Resource: 16© 2011 Energized Work - www.energizedwork.com
  • 17. Cookbooks – Recipes • Basic examples of resources 17© 2011 Energized Work - www.energizedwork.com package "tar" do version "1.16.1-1" action :install end remote_file "/tmp/testfile" do source "http://build.ew/warfiles/testfile" mode "0644" checksum "08da002l" end service ”httpd" do supports :status => true, :restart => true, :reload => true action [ :enable, :start ] end cookbook_file "/tmp/testfile" do source "testfile" mode "0644" end directory "/tmp/something" do owner "root" group "root" mode "0755" action :create end template "/tmp/config.conf" do source "config.conf.erb" end link "/tmp/passwd" do to "/etc/passwd" end
  • 18. Cookbooks – Files and templates • Files allow you to distribute files to your servers as part of cookbooks • Templates are files that have been marked up to include variables • To allow cookbooks to operate on multiple platforms, files and templates can be found in a number of locations within a cookbook 18© 2011 Energized Work - www.energizedwork.com Eg in order of priority. cookbook/templates/webapp01.ew/sudoers.erb cookbook/templates/ubuntu-8.04/sudoers.erb cookbook/templates/ubuntu/sudoers.erb cookbook/templates/default/sudoers.erb
  • 19. Cookbooks – Template example • Simple template resource • Simple ERB template file – templates/default/foo.erb • Rendered file on client 19© 2011 Energized Work - www.energizedwork.com node[:fqdn] = ”webapp01.ew" template "/tmp/foo" do source "foo.erb" variables({ :java_app => ”SomethingCool.war" }) end The node <%= node[:fqdn] %> is running the app <%= @java_app %> # cat /tmp/foo The node webapp01.ew is running the app SomethingCool.war #
  • 20. Useful links • http://www.opscode.com/ • http://wiki.opscode.com/display/chef/Home • http://wiki.opscode.com/display/chef/Resources • http://cookbooks.opscode.com/ • https://github.com/37signals/37s_cookbooks • https://github.com/opscode/cookbooks 20© 2011 Energized Work - www.energizedwork.com
  • 21. Chef Examples 21© 2011 Energized Work - www.energizedwork.com
  • 22. 22© 2011 Energized Work - www.energizedwork.com Thank you Email: michael@energizedwork.com

Editor's Notes

  1. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  2. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  3. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  4. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  5. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  6. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  7. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  8. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  9. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  10. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  11. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  12. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  13. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  14. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  15. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  16. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  17. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  18. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  19. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  20. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  21. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  22. 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING