Cooking with Chef

956 views

Published on

Discusses Chef basics with a focus on managing workflow and changes to your infrastructure

Published in: Self Improvement, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
956
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
18
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Cooking with Chef

  1. 1. Cooking with ChefMichael Richardson @Mr_SPB
  2. 2. Topics• What is Chef• chef-client software• What does “Infrastructure as code” look like• What’s in a Cookbook• Testing your infrastructure code• Workflow
  3. 3. Chef Architecture
  4. 4. Chef Client SoftwareCommands• ohai (nodes)• chef-client (nodes)• chef-solo (nodes)• shef (node / workstation)• knife (workstations / build hosts?)
  5. 5. Infrastructure as Code
  6. 6. What is a cookbook• Fundamental units in Chef• Encapsulate resources• Contains recipes
  7. 7. Resources
  8. 8. Want more resources?
  9. 9. Enter LWRP
  10. 10. The Common CookbookCooking 101Step 1 - Install some softwareStep 2 - Create a config file for the softwareStep 3 - Start the software and set it to alwaysstart on system boot
  11. 11. The Common Cookbook• NTP example• chef-repo/cookbooks/ntp/recipes/default.rb
  12. 12. Demo Time• NTP cookbook
  13. 13. Config FilesWhat normally goes in a config file?• Credentials (eg for a DB)• Application config switches• Application settings• Information about the local node• Information about other nodes in your system
  14. 14. Config FilesWhat normally goes in a config file?• Credentials (eg for a DB)• Application config switches• Application settings• Information about the local node• Information about other nodes in your systemWhere can we gather information from to• Chef Data Bags• Cookbook attributes• Node attributes• Peer node information via Chef search
  15. 15. Config Files - examplescookbook/postgresql/recipes/server.rbcookbook/postgresql/templates/default/postgres_pg_hba.conf.erb
  16. 16. Testing Tools• Vagrant• [http://vagrantup.com]• foodcritic• [http://acrmp.github.com/foodcritic/]• minitest-handler• [https://github.com/calavera/minitest-chef-handler]• chefspec• [https://github.com/acrmp/chefspec]• [https://github.com/customink/fauxhai]• test-kitchen• [https://github.com/opscode/test-kitchen]
  17. 17. Cookbook WorkflowYou need to consider• Run chef-client as a daemon or on-demand• Version cookbooks• Push cookbook updates from your workstation or a build server• Use no-op or why-run options
  18. 18. Questions
  19. 19. QuestionsIs Chef Awesome?
  20. 20. QuestionsIs Chef Awesome?
  21. 21. Anymore Questions?

×