#Used to configure variables for the app per environment (instead of attributes). #I have since refactored how this works so treat this as example code, aka I #have not tested this and it is not complete. #FWIW using libraries in the cookbook to set these variables #for smaller apps I would keep this in the attributes app_name = 'yourname' default = { name: app_name gemset: app_name ruby_ver: 'ruby-1.8.7-p352', deploy_user: 'deployer', environment: node[:environment], #... } staging = { app_root: '/export/staging/yourname', #... } case node[:environment] when "staging" rails_attributes = Chef::Mixin::DeepMerge.merge(default, staging) end # Don't know why I saved this in a seperate hash before the deep merge... original_node_attributes = node.default.to_hash node.default[:rails] = Chef::Mixin::DeepMerge.merge(rails_attributes, original_node_attributes["rails"])