Skip to content

Instantly share code, notes, and snippets.

@BitOfUniverse
Created March 20, 2017 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BitOfUniverse/bea1a05f13ccfc1b183b00a71d6d6ef5 to your computer and use it in GitHub Desktop.
Save BitOfUniverse/bea1a05f13ccfc1b183b00a71d6d6ef5 to your computer and use it in GitHub Desktop.
SSH to capistrano server
# lib/capistrano/tasks/ssh.rake
#
# Usage: cap staging ssh
desc 'Connects thru SSH to server'
task :ssh do
on roles(:app) do |server|
ssh_command = nil
with_props(server) do |host, user|
ssh_command = "ssh #{user}@#{host}"
end
exec ssh_command
end
end
def with_props(server)
yield server.hostname, server.user
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment