Skip to content

Instantly share code, notes, and snippets.

@alexaivars
Created November 1, 2011 13:27
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alexaivars/1330493 to your computer and use it in GitHub Desktop.
Save alexaivars/1330493 to your computer and use it in GitHub Desktop.
Use fabric with a vagrant instance
from fabric.api import env, local, run
def vagrant():
# change from the default user to 'vagrant'
env.user = 'vagrant'
# connect to the port-forwarded ssh
env.hosts = ['127.0.0.1:2222']
# use vagrant ssh key
result = local('vagrant ssh_config | grep IdentityFile', capture=True)
env.key_filename = result.split()[1]
def uname():
run('uname -a')
@craigafinch
Copy link

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