Chef Dialects

811 views
680 views

Published on

From Chef Summit 2013

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
811
On SlideShare
0
From Embeds
0
Number of Embeds
15
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Chef Dialects

  1. 1. Chef Dialects Noah Kantrowitz Balanced, Inc
  2. 2. 10KM View • Hooks to load from non-.rb Improvements to layout •
  3. 3. Dialect Hooks • Recipes Attributes • Metadata • • Roles • Data bags
  4. 4. Rules • Side effect based • Ruby classes • File extension, MIME type
  5. 5. Cookbook Dialects • • depends 'dialect-js' attributes/default.yml • • recipes/default.js Distributed as cookbooks
  6. 6. dialect-js template('/tmp/foo', { source: 'foo.erb', owner: 'root', variables: {msg: node.msg} })
  7. 7. dialect-py import chef chef.template('/tmp/foo', source='foo.erb', owner='root', variables={'msg':'Hello'} )
  8. 8. Knife Dialects • Distributed as gems, knife plugins • gem install knife-dialect-erbyaml • knife role from file web.yml • knife data bag from file users jdoe.yml
  9. 9. Current Dialects • Javascript, based on therubyracer/V8 • Python, incomplete, based on ffi + libpython • JSON • YAML and ERB+YAML • ...
  10. 10. Current Dialects • Javascript, based on therubyracer/V8 • Python, incomplete, based on ffi + libpython • JSON • YAML and ERB+YAML • Puppet (soon)
  11. 11. Next steps • chef_fs for knife upload and chef-client -z • More dialects • Perl? • Java? • TOML? • Templates?
  12. 12. Layout Shortcuts • attributes/default.rb ➡ attributes.rb • recipes/default.js ➡ recipe.js • libraries/default.rb ➡ library.rb
  13. 13. RIP Specificity • templates/foo.erb files/foo.ini •
  14. 14. Default lookup • source 'foo.erb' • host-fqdn/foo.erb • platform-version/foo.erb • platform/foo.erb • default/foo.erb • foo.erb ☺☺☺
  15. 15. Explicit Lookup • source ['one.erb', 'two.erb'] • source [ "host-#{node['fqdn']}/name", "#{node['platform']}-#{node['platform_version']}/name", "#{node['platform']}/name", "default/name", ]
  16. 16. Putting It All Together my-postgresql/ attributes.json metadata.yml recipe.py templates/ postgresql.conf.erb
  17. 17. When? • github.com/coderanger/chef/tree/dialects • Chef 12?

×