cooking an omelette with chef
DESCRIPTION
A talk given at Rails Israel about getting value with Chef at your enterprise while minimizing the common errors that people make.TRANSCRIPT
![Page 1: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/1.jpg)
Cooking an Omelette with Chef
Case Taintor
Wednesday, October 9, 13
![Page 2: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/2.jpg)
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
![Page 3: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/3.jpg)
Purpose
Wednesday, October 9, 13
![Page 4: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/4.jpg)
Wednesday, October 9, 13
![Page 5: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/5.jpg)
How did we work?
Wednesday, October 9, 13
![Page 6: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/6.jpg)
Wednesday, October 9, 13
![Page 7: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/7.jpg)
Infrastructure as Code
Wednesday, October 9, 13
![Page 8: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/8.jpg)
Wednesday, October 9, 13
![Page 9: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/9.jpg)
Wednesday, October 9, 13
![Page 10: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/10.jpg)
Wednesday, October 9, 13
![Page 11: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/11.jpg)
Wednesday, October 9, 13
![Page 12: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/12.jpg)
Wednesday, October 9, 13
![Page 13: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/13.jpg)
Wednesday, October 9, 13
![Page 14: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/14.jpg)
Where do we start?
Wednesday, October 9, 13
![Page 15: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/15.jpg)
Priorities
• Reproducibility
• Testability
• Traceability
• Keep It Simple, Stupid
Wednesday, October 9, 13
![Page 16: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/16.jpg)
How does Chef work?
• Figures out which instructions to run
• Runs them in an idempotent way
Wednesday, October 9, 13
![Page 17: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/17.jpg)
Cookbook
Everything to install & configure a component
Wednesday, October 9, 13
![Page 18: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/18.jpg)
Cookbooks
attributesdefinitionsfileslibrariesprovidersrecipesresourcestemplates
attributesdefinitionsfileslibrariesprovidersrecipesresourcestemplatesmetadata.rb
$ ls -1 cookbook
Wednesday, October 9, 13
![Page 19: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/19.jpg)
Cookbooks
attributesdefinitionsfileslibrariesprovidersrecipesresourcestemplatesmetadata.rb
$ ls -1 cookbook
Wednesday, October 9, 13
![Page 20: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/20.jpg)
nginx cookbook
attributesdefinitionsfileslibrariesprovidersrecipesresourcestemplates
attributesattributes/default.rbattributes/source.rbdefinitionsfilesrecipesrecipes/default.rbrecipes/source.rbtemplatesmetadata.rb
$ ls -1 nginx
Wednesday, October 9, 13
![Page 21: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/21.jpg)
Then What?
Wednesday, October 9, 13
![Page 22: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/22.jpg)
run_list
{ ... "run_list": [ "recipe[rvm::system]", "recipe[nginx]", "recipe[user]" ] ...}
Wednesday, October 9, 13
![Page 23: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/23.jpg)
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
![Page 24: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/24.jpg)
Problems
Problem Solution
RepeatabilityReproducibilityIdempotence
Chef
Wednesday, October 9, 13
![Page 25: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/25.jpg)
Problems
Problem Solution
RepeatabilityReproducibilityIdempotence
Chef
Versioning
Wednesday, October 9, 13
![Page 26: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/26.jpg)
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
![Page 27: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/27.jpg)
BerkshelfWednesday, October 9, 13
![Page 28: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/28.jpg)
Problems
Problem Solution
RepeatabilityReproducibilityIdempotence
Chef
Versioning Berkshelf
Wednesday, October 9, 13
![Page 29: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/29.jpg)
Problems
Problem Solution
RepeatabilityReproducibilityIdempotence
Chef
Versioning Berkshelf
Development
Wednesday, October 9, 13
![Page 30: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/30.jpg)
Wednesday, October 9, 13
![Page 31: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/31.jpg)
Problems
Problem Solution
RepeatabilityReproducibilityIdempotence
Chef
Versioning Berkshelf
Development Vagrant + VirtualBox
Wednesday, October 9, 13
![Page 32: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/32.jpg)
Problems
Problem Solution
RepeatabilityReproducibilityIdempotence
Chef
Versioning Berkshelf
Development Vagrant + VirtualBox
KISS
Wednesday, October 9, 13
![Page 33: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/33.jpg)
GusteauWednesday, October 9, 13
![Page 34: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/34.jpg)
Problems
Problem Solution
RepeatabilityReproducibilityIdempotence
Chef
Versioning Berkshelf
Development Vagrant + VirtualBox
KISS Gusteau
Wednesday, October 9, 13
![Page 35: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/35.jpg)
omelette-server• rvm • nginx • users
Wednesday, October 9, 13
![Page 36: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/36.jpg)
Process
$ gusteau init omelette-cooker
Wednesday, October 9, 13
![Page 37: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/37.jpg)
Berksfile
site :opscode
cookbook 'rvm', :github => 'fnichol/chef-rvm'cookbook 'nginx'cookbook 'user'
Wednesday, October 9, 13
![Page 38: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/38.jpg)
.gusteau.yml
...environments: development: nodes: web: run_list: - recipe[rvm::system] - recipe[nginx] - recipe[user::data_bag] ...
Wednesday, October 9, 13
![Page 39: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/39.jpg)
$ vagrant up development-web
$ gusteau converge development-web
Wednesday, October 9, 13
![Page 40: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/40.jpg)
Wednesday, October 9, 13
![Page 41: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/41.jpg)
Next Problems
Wednesday, October 9, 13
![Page 42: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/42.jpg)
Share your stuff
• Inside your organization
• Outside your organization
Wednesday, October 9, 13
![Page 43: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/43.jpg)
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
![Page 44: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/44.jpg)
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
![Page 45: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/45.jpg)
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
![Page 46: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/46.jpg)
Wrapper Cookbooks
place dependencies in metadata.rb
depends ‘rvm’, ‘0.9.1’
site-cookbooks/wrapper-rvm/metadata.rb
Wednesday, October 9, 13
![Page 47: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/47.jpg)
.gusteau.yml
...environments: development: nodes: web: run_list: - recipe[wrapper-rvm] - recipe[nginx] - recipe[user::data_bag] ...
Wednesday, October 9, 13
![Page 48: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/48.jpg)
$ vagrant up development-web
$ gusteau converge development-web
Wednesday, October 9, 13
![Page 49: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/49.jpg)
Share
Wednesday, October 9, 13
![Page 50: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/50.jpg)
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
![Page 51: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/51.jpg)
Next Steps
• Sharing common setups
• Cookbook development
• Move to Chef Server
Wednesday, October 9, 13
![Page 52: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/52.jpg)
Wrap Up
• Recognize what you want
• Use tools
• Iterate
Wednesday, October 9, 13
![Page 53: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/53.jpg)
Questions?
More Info: @ctaintorWednesday, October 9, 13
![Page 54: Cooking an Omelette with Chef](https://reader033.vdocuments.us/reader033/viewer/2022052410/55496612b4c9056e598b482c/html5/thumbnails/54.jpg)
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