Created
July 13, 2013 01:51
-
-
Save marsam/5989064 to your computer and use it in GitHub Desktop.
fabric vagrant integration
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| from fabric.api import env | |
| from fabric.decorators import task | |
| from fabric.operations import run, local | |
| env.timeout = 120 | |
| # env.hosts = ['motoko', 'batou', 'tachikoma'] | |
| env.forward_agent = True | |
| env.use_ssh_config = True | |
| @task(default=True) | |
| def uname(): | |
| run('uname -a') | |
| @task | |
| def vagrant(): | |
| output = local('vagrant ssh-config', capture=True) | |
| sshcfg = dict(a.split() for a in output.split('\n')) | |
| env.user = sshcfg['User'] | |
| env.port = sshcfg['Port'] | |
| env.hosts = [sshcfg['HostName']] | |
| env.key_filename = sshcfg['IdentityFile'].replace('"', '') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment