Created
November 28, 2012 21:42
-
-
Save kuleszaj/4164800 to your computer and use it in GitHub Desktop.
This file contains 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
namespace :chef do | |
task :default do | |
# Tar up Chef Cookbooks and Roles | |
system("tar czf 'chef.tar.gz' -C chef/ .") | |
# Upload | |
upload("chef.tar.gz","/home/#{user}",:via => :scp) | |
# Remove existing Chef dir to avoid conflicts... | |
run("rm -rf /home/#{user}/chef") | |
run("mkdir -p /home/#{user}/chef") | |
# Untar new Chef Cookbooks and Rols | |
run("tar xzf 'chef.tar.gz' -C /home/#{user}/chef") | |
# Run Chef Solo | |
sudo("/bin/bash -c 'cd /home/#{user}/chef && #{chef_binary} -c solo.rb -j #{stage}.json'") | |
# Clean up | |
run("rm -rf /home/#{user}/chef.tar.gz") | |
run("rm -rf /home/#{user}/chef") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment