Skip to content

Instantly share code, notes, and snippets.

@nathany
Created March 7, 2011 03:51
Show Gist options
  • Save nathany/858040 to your computer and use it in GitHub Desktop.
Save nathany/858040 to your computer and use it in GitHub Desktop.
Vagrant deploy.rb for Sprinkle using Capistrano delivery method
set :user, 'vagrant'
set :run_method, :sudo
role :app, '33.33.33.10'
ssh_options[:keys] = `vagrant ssh_config | grep IdentityFile`.split.last
package :rvm do
description 'Ruby Version Manager'
runner ['curl -LsS http://bit.ly/rvm-install-system-wide > rvm-install-system-wide', 'bash < ./rvm-install-system-wide'] do
post :install, "usermod -a -G rvm vagrant" # Capistrano fetch(:user) ?
end
push_text "[[ -s '/usr/local/lib/rvm' ]] && source '/usr/local/lib/rvm'", "~/.profile"
requires :rvm_dependencies
verify do
has_executable 'rvm'
end
end
package :rvm_dependencies do
description 'Ruby Version Manager dependencies'
apt %w(curl bison git-core)
end
package :ree, :provides => :ruby do
description 'Ruby Enterprise Edition'
version '1.8.7'
push_text '--silent --show-error', '~/.curlrc' # want no progress bar!
runner "rvm install ree-#{version}" do
post :install, "rvm ree-#{version} --default"
end
requires :rvm, :ree_dependencies
verify do
has_executable_with_version 'ruby', 'Ruby Enterprise Edition'
end
end
package :ree_dependencies do
description 'Ruby Enterprise Edition dependencies'
apt %w(build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev)
end
policy :vagrant, :roles => :app do
requires :ruby
end
deployment do
delivery :capistrano
source do
prefix '/usr/local'
archives '/usr/local/sources'
builds '/usr/local/build'
end
end
@nathany
Copy link
Author

nathany commented Mar 7, 2011

Sprinkle kept prompting me for a password, despite having the IdentityFile specified in my ~/.ssh/config. Specifying it in deploy.rb does the trick.

@nathany
Copy link
Author

nathany commented Mar 8, 2011

This Sprinkle install recipe isn't actually working yet. :-(

@technicalpickles
Copy link

You might need a chomp on the ssh_options[:keys]. I ended up going with:

ssh_options[:keys] = `vagrant ssh_config | grep IdentityFile | awk '{print $2}'`.chomp

@redmar
Copy link

redmar commented Mar 22, 2012

i do not know in which version of vagrant it changed but here with 1.0.0 i need to change ssh_config to ssh-config for it to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment