-
-
Save rrichards/428239 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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 = ERB.new(File.read(source)).result(binding) | |
File.open(target, 'w') {|f| f.write(t)} | |
end | |
desc "Run chef-solo cookbook(s)." | |
task :solo => :template do | |
sh("chef-solo -l debug -c config/solo.rb -j config/dna.json") | |
end | |
### dna.json | |
{ | |
"user":"root", | |
"packages":[], | |
"gems":[], | |
"users":[], | |
"recipes":[<%= @to_run %>] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment