Created
July 8, 2012 19:15
-
-
Save kuleszaj/3072375 to your computer and use it in GitHub Desktop.
Capistrano Configuration to Run Puppet
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
require "rvm/capistrano" | |
... | |
namespace :bootstrap do | |
task :default do | |
# Specific RVM string for managing Puppet; may or may not match the RVM string for the application | |
set :user, "ubuntu" | |
# Set the default_shell to "bash" so that we don't use the RVM shell which isn't installed yet... | |
set :default_shell, "bash" | |
# We tar up the puppet directory from the current directory -- the puppet directory within the source code repository | |
system("tar czf 'puppet.tgz' puppet/") | |
upload("puppet.tgz","/home/#{user}",:via => :scp) | |
# Untar the puppet directory, and place at /etc/puppet -- the default location for manifests/modules | |
run("tar xzf puppet.tgz") | |
try_sudo("rm -rf /etc/puppet") | |
try_sudo("mv /home/#{user}/puppet/ /etc/puppet") | |
# Bootstrap RVM/Puppet! | |
try_sudo("bash /etc/puppet/bootstrap.sh") | |
end | |
end | |
namespace :puppet do | |
task :default do | |
# Specific RVM string for managing Puppet; may or may not match the RVM string for the application | |
set :rvm_ruby_string, '1.9.3-p125' | |
set :rvm_type, :system | |
set :user, "ubuntu" | |
# We tar up the puppet directory from the current directory -- the puppet directory within the source code repository | |
system("tar czf 'puppet.tgz' puppet/") | |
upload("puppet.tgz","/home/#{user}",:via => :scp) | |
# Untar the puppet directory, and place at /etc/puppet -- the default location for manifests/modules | |
run("tar xzf puppet.tgz") | |
try_sudo("rm -rf /etc/puppet") | |
try_sudo("mv puppet/ /etc/puppet") | |
# Run RVM/Puppet! | |
run("rvmsudo -p '#{sudo_prompt}' puppet apply /etc/puppet/manifests/site.pp") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment