Skip to content

Instantly share code, notes, and snippets.

@kuleszaj
Created November 28, 2012 21:42
Show Gist options
  • Save kuleszaj/4164800 to your computer and use it in GitHub Desktop.
Save kuleszaj/4164800 to your computer and use it in GitHub Desktop.
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