Cooking an Omelette with Chef

843 views

Published on

A talk given at Rails Israel about getting value with Chef at your enterprise while minimizing the common errors that people make.

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

No Downloads
Views
Total views
843
On SlideShare
0
From Embeds
0
Number of Embeds
84
Actions
Shares
0
Downloads
9
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Cooking an Omelette with Chef

  1. 1. Cooking an Omelette with Chef Case Taintor Wednesday, October 9, 13
  2. 2. Survey • Who has been manually configuring their machines? • Who has been using a tool like Chef or Puppet? • Who is an expert in Chef? Wednesday, October 9, 13
  3. 3. Purpose Wednesday, October 9, 13
  4. 4. Wednesday, October 9, 13
  5. 5. How did we work? Wednesday, October 9, 13
  6. 6. Wednesday, October 9, 13
  7. 7. Infrastructure as Code Wednesday, October 9, 13
  8. 8. Wednesday, October 9, 13
  9. 9. Wednesday, October 9, 13
  10. 10. Wednesday, October 9, 13
  11. 11. Wednesday, October 9, 13
  12. 12. Wednesday, October 9, 13
  13. 13. Wednesday, October 9, 13
  14. 14. Where do we start? Wednesday, October 9, 13
  15. 15. Priorities • Reproducibility • Testability • Traceability • Keep It Simple, Stupid Wednesday, October 9, 13
  16. 16. How does Chef work? • Figures out which instructions to run • Runs them in an idempotent way Wednesday, October 9, 13
  17. 17. Cookbook Everything to install & configure a component Wednesday, October 9, 13
  18. 18. Cookbooks attributes definitions files libraries providers recipes resources templates attributes definitions files libraries providers recipes resources templates metadata.rb $ ls -1 cookbook Wednesday, October 9, 13
  19. 19. Cookbooks attributes definitions files libraries providers recipes resources templates metadata.rb $ ls -1 cookbook Wednesday, October 9, 13
  20. 20. nginx cookbook attributes definitions files libraries providers recipes resources templates attributes attributes/default.rb attributes/source.rb definitions files recipes recipes/default.rb recipes/source.rb templates metadata.rb $ ls -1 nginx Wednesday, October 9, 13
  21. 21. Then What? Wednesday, October 9, 13
  22. 22. run_list { ... "run_list": [ "recipe[rvm::system]", "recipe[nginx]", "recipe[user]" ] ... } Wednesday, October 9, 13
  23. 23. How do I run Chef? node1 chef-solo all config node2 chef-solo all config chef-solo node1 chef-client config node2 chef-client config chef-server chef-server config Wednesday, October 9, 13
  24. 24. Problems Problem Solution Repeatability Reproducibility Idempotence Chef Wednesday, October 9, 13
  25. 25. Problems Problem Solution Repeatability Reproducibility Idempotence Chef Versioning Wednesday, October 9, 13
  26. 26. default rvm default['rvm']['default_ruby'] = "ruby-1.9.3-p327" default['rvm']['rubies'] = [] default[‘rvm][‘version’] = “head” rvm/attributes/default.rb Wednesday, October 9, 13
  27. 27. Berkshelf Wednesday, October 9, 13
  28. 28. Problems Problem Solution Repeatability Reproducibility Idempotence Chef Versioning Berkshelf Wednesday, October 9, 13
  29. 29. Problems Problem Solution Repeatability Reproducibility Idempotence Chef Versioning Berkshelf Development Wednesday, October 9, 13
  30. 30. Wednesday, October 9, 13
  31. 31. Problems Problem Solution Repeatability Reproducibility Idempotence Chef Versioning Berkshelf Development Vagrant +VirtualBox Wednesday, October 9, 13
  32. 32. Problems Problem Solution Repeatability Reproducibility Idempotence Chef Versioning Berkshelf Development Vagrant +VirtualBox KISS Wednesday, October 9, 13
  33. 33. Gusteau Wednesday, October 9, 13
  34. 34. Problems Problem Solution Repeatability Reproducibility Idempotence Chef Versioning Berkshelf Development Vagrant +VirtualBox KISS Gusteau Wednesday, October 9, 13
  35. 35. omelette-server • rvm • nginx • users Wednesday, October 9, 13
  36. 36. Process $ gusteau init omelette-cooker Wednesday, October 9, 13
  37. 37. Berksfile site :opscode cookbook 'rvm', :github => 'fnichol/chef-rvm' cookbook 'nginx' cookbook 'user' Wednesday, October 9, 13
  38. 38. .gusteau.yml ... environments: development: nodes: web: run_list: - recipe[rvm::system] - recipe[nginx] - recipe[user::data_bag] ... Wednesday, October 9, 13
  39. 39. $ vagrant up development-web $ gusteau converge development-web Wednesday, October 9, 13
  40. 40. Wednesday, October 9, 13
  41. 41. Next Problems Wednesday, October 9, 13
  42. 42. Share your stuff • Inside your organization • Outside your organization Wednesday, October 9, 13
  43. 43. default rvm default['rvm']['default_ruby'] = "ruby-1.9.3-p327" default['rvm']['rubies'] = [] default[‘rvm][‘version’] = “head” rvm/attributes/default.rb Wednesday, October 9, 13
  44. 44. your rvm modifications default['rvm']['default_ruby'] = "ruby-1.9.3-p448" default['rvm']['rubies'] = ["ruby-1.9.3-p448", "ruby-1.9.3-p327"] default[‘rvm][‘version’] = "1.21.4" rvm/attributes/default.rb Wednesday, October 9, 13
  45. 45. Wrapper Cookbooks $ knife cookbook create wrapper-rvm -o site-cookbooks normal[:rvm][:default_ruby] = "ruby-1.9.3-p448" normal[:rvm][:rubies] = ["ruby-1.9.3-p448", "ruby-1.9.3-p327"] normal[:rvm][:version] = "1.21.4" include_recipe "rvm::system" site-cookbooks/wrapper-rvm/attributes/default.rb site-cookbooks/wrapper-rvm/recipes/default.rb Wednesday, October 9, 13
  46. 46. Wrapper Cookbooks place dependencies in metadata.rb depends ‘rvm’, ‘0.9.1’ site-cookbooks/wrapper-rvm/metadata.rb Wednesday, October 9, 13
  47. 47. .gusteau.yml ... environments: development: nodes: web: run_list: - recipe[wrapper-rvm] - recipe[nginx] - recipe[user::data_bag] ... Wednesday, October 9, 13
  48. 48. $ vagrant up development-web $ gusteau converge development-web Wednesday, October 9, 13
  49. 49. Share Wednesday, October 9, 13
  50. 50. Berksfile site :opscode cookbook 'rvm', :github => 'fnichol/chef-rvm' cookbook 'nginx' cookbook 'user' cookbook ‘wrapper-rvm’, :git => ‘...:wrapper- rvm.git, :branch => ‘0.1.0’ Wednesday, October 9, 13
  51. 51. Next Steps • Sharing common setups • Cookbook development • Move to Chef Server Wednesday, October 9, 13
  52. 52. Wrap Up • Recognize what you want • Use tools • Iterate Wednesday, October 9, 13
  53. 53. Questions? More Info: @ctaintor Wednesday, October 9, 13
  54. 54. Image References Danley, Brent. "Crowded Beach." Flickr.Yahoo!, n.d.Web. 05 Oct. 2013. <http:// www.flickr.com/photos/brentdanley/1086226020/>. Goehring, David. "Does Not Work." Flickr.Yahoo!, n.d.Web. 04 Oct. 2013. <http://www.flickr.com/photos/carbonnyc/496721450/>. Harber, Chris. "Food I Made 1." Flickr.Yahoo!, n.d.Web. 07 Oct. 2013. <http:// www.flickr.com/photos/britishchris/4437265186/>. Johnson, Darren. "Koh Ngai." Flickr. ShotHotspot.com, n.d.Web. 04 Oct. 2013. <http://www.flickr.com/photos/dazjohnson/7424536244/>. Komulainen,Tommi. "Handlebar Is No More." Flickr.Yahoo!, n.d.Web. 05 Oct. 2013. <http://www.flickr.com/photos/tommikomulainen/137069098/>. Reck, Bob. "My Motorcycle." Flickr.Yahoo!, n.d.Web. 05 Oct. 2013. <http:// www.flickr.com/photos/u2sockmonkey/116641053/>.Used with permission. Wednesday, October 9, 13

×