Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
### Rakefile
task :template do
require 'yaml'
require 'erb'
base = File.join(File.dirname(__FILE__), 'config')
source = File.join(base, 'dna.json.erb')
target = File.join(base, 'dna.json')
recipes = ENV['recipe'] || %w(packages users gems)
@to_run = recipes.collect {|r| %Q("#{r}")}.join(',')
t =, 'w') {|f| f.write(t)}
desc "Run chef-solo cookbook(s)."
task :solo => :template do
sh("chef-solo -l debug -c config/solo.rb -j config/dna.json")
### dna.json
"recipes":[<%= @to_run %>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.