Michael RichardsonEmail: michael@energizedwork.com2© 2011 Energized Work - www.energizedwork.com
AgendaChef Architecture• Chef Server• Chef Client• Web UI• Chef Solo• KnifeChef Basics• Cookbooks• Nodes• Roles• Attribute...
Chef Architecture4© 2011 Energized Work - www.energizedwork.com
Chef Server – Architecture5© 2011 Energized Work - www.energizedwork.comServer components:• Chef Server• Chef Server Web U...
Chef Server• Merb Web application• API service• Data stored with CouchDB• Distributes cookbooks to Chef Clients6© 2011 Ene...
Chef Server Web UI• Merb Web application• Talks to Chef Server API service• Data stored with CouchDB7© 2011 Energized Work...
Knife• Command line interface to Chef• Alternative to using the Chef-Server Web UI• Allows you to create, list, edit and d...
Chef Client• Clients do all the work• Communicates with Chef Server via REST• Downloads, Compiles and Executes cookbooks• ...
Chef Basics10© 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 ...
Nodes – Run List• Run list is a list of the recipes that a node will run• Order is important• Can include roles which may ...
Attributes• Nodes and roles have associated attributes (key-value pairs)• Node and role attributes are used as inputs for ...
Roles• Compose functionality sets for nodes through recipes and attributes• 2 workflows for managing roles• Write Ruby or ...
Cookbooks• Collection of files used to configure a system/cookbook//attributes//definitions//files//libraries//metadata.rb...
Cookbooks – Recipes• Encapsulates resources (fundamental units in Chef)• Resource:16© 2011 Energized Work - www.energizedw...
Cookbooks – Recipes• Basic examples of resources17© 2011 Energized Work - www.energizedwork.compackage "tar" doversion "1....
Cookbooks – Files and templates• Files allow you to distribute files to your servers as part of cookbooks• Templates are f...
Cookbooks – Template example• Simple template resource• Simple ERB template file – templates/default/foo.erb• Rendered fil...
Useful links• http://www.opscode.com/• http://wiki.opscode.com/display/chef/Home• http://wiki.opscode.com/display/chef/Res...
Chef Examples21© 2011 Energized Work - www.energizedwork.com
22© 2011 Energized Work - www.energizedwork.comThank youEmail: michael@energizedwork.com
Chef - managing yours servers with Code
Upcoming SlideShare
Loading in...5
×

Chef - managing yours servers with Code

604

Published on

Chef talk i gave back January 2011

Published in: Technology, Self Improvement
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
604
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
17
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • 28/10/10 © Energized Work Limited 2010 Agile Evangelists - LEANING
  • Chef - managing yours servers with Code

    1. 1. Michael RichardsonEmail: michael@energizedwork.com2© 2011 Energized Work - www.energizedwork.com
    2. 2. AgendaChef Architecture• Chef Server• Chef Client• Web UI• Chef Solo• KnifeChef Basics• Cookbooks• Nodes• Roles• AttributesExamplesUseful links3© 2011 Energized Work - www.energizedwork.com
    3. 3. Chef Architecture4© 2011 Energized Work - www.energizedwork.com
    4. 4. Chef Server – Architecture5© 2011 Energized Work - www.energizedwork.comServer components:• Chef Server• Chef Server Web UI• CouchDB• RabbitMQ• Chef Solr Indexer• Chef SolrClient components:• Chef Client• Chef Solo• Knife• Shef
    5. 5. Chef Server• Merb Web application• API service• Data stored with CouchDB• Distributes cookbooks to Chef Clients6© 2011 Energized Work - www.energizedwork.com
    6. 6. Chef Server Web UI• Merb Web application• Talks to Chef Server API service• Data stored with CouchDB7© 2011 Energized Work - www.energizedwork.com
    7. 7. 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-Server8© 2011 Energized Work - www.energizedwork.com
    8. 8. 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 Chef9© 2011 Energized Work - www.energizedwork.com
    9. 9. Chef Basics10© 2011 Energized Work - www.energizedwork.com
    10. 10. 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• Roles11© 2011 Energized Work - www.energizedwork.com
    11. 11. 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 them12© 2011 Energized Work - www.energizedwork.com
    12. 12. 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• Nodes13© 2011 Energized Work - www.energizedwork.com
    13. 13. Roles• Compose functionality sets for nodes through recipes and attributes• 2 workflows for managing roles• Write Ruby or JSON files• Use Knife or Web UI14© 2011 Energized Work - www.energizedwork.com
    14. 14. 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 community15© 2011 Energized Work - www.energizedwork.com
    15. 15. Cookbooks – Recipes• Encapsulates resources (fundamental units in Chef)• Resource:16© 2011 Energized Work - www.energizedwork.com
    16. 16. Cookbooks – Recipes• Basic examples of resources17© 2011 Energized Work - www.energizedwork.compackage "tar" doversion "1.16.1-1"action :installendremote_file "/tmp/testfile" dosource "http://build.ew/warfiles/testfile"mode "0644"checksum "08da002l"endservice ”httpd" dosupports :status => true, :restart => true, :reload => trueaction [ :enable, :start ]endcookbook_file "/tmp/testfile" dosource "testfile"mode "0644"enddirectory "/tmp/something" doowner "root"group "root"mode "0755"action :createendtemplate "/tmp/config.conf" dosource "config.conf.erb"endlink "/tmp/passwd" doto "/etc/passwd"end
    17. 17. 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 andtemplates can be found in a number of locations within a cookbook18© 2011 Energized Work - www.energizedwork.comEg in order of priority.cookbook/templates/webapp01.ew/sudoers.erbcookbook/templates/ubuntu-8.04/sudoers.erbcookbook/templates/ubuntu/sudoers.erbcookbook/templates/default/sudoers.erb
    18. 18. Cookbooks – Template example• Simple template resource• Simple ERB template file – templates/default/foo.erb• Rendered file on client19© 2011 Energized Work - www.energizedwork.comnode[:fqdn] = ”webapp01.ew"template "/tmp/foo" dosource "foo.erb"variables({:java_app => ”SomethingCool.war"})endThe node <%= node[:fqdn] %> is running the app <%= @java_app %># cat /tmp/fooThe node webapp01.ew is running the app SomethingCool.war#
    19. 19. 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/cookbooks20© 2011 Energized Work - www.energizedwork.com
    20. 20. Chef Examples21© 2011 Energized Work - www.energizedwork.com
    21. 21. 22© 2011 Energized Work - www.energizedwork.comThank youEmail: michael@energizedwork.com
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×