Chef: create a directory for a template if it doesn’t already exist
Use the directory resource to create the directory before creating the template. The trick is to also specify the recursive attribute otherwise the action will fail unless all parts of the directory but the last exist already. config_dir = “#{node[:app][:deploy_to]}/#{node[:app][:name]}/shared/config” directory config_dir do owner node[:user][:username] group node[:user][:username] recursive true end template “#{config_dir}/database.yml” do source “database.yml.erb” … Read more