Created
February 11, 2014 14:34
-
-
Save maracuja/8935926 to your computer and use it in GitHub Desktop.
My Default Fab Commands
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
from fabric.api import * | |
from fabric.colors import cyan, green | |
print(cyan('')) | |
print(cyan(' _,-""`""-~`)')) | |
print(cyan('(`~ \\')) | |
print(cyan(' | a a \\')) | |
print(cyan(' ; o ; ___ _,,,,_ _.-~\'.')) | |
print(cyan(' \ `^` /`_.-"~ `~-;` \\')) | |
print(cyan(' \_ _ .\' `, |')) | |
print(cyan(' |`- \\\'__/')) | |
print(cyan(' / ,_ \ `\'-.')) | |
print(cyan(' / .-""~~--. `"-, ;_ /')) | |
print(cyan(' | \ \ | `""`')) | |
print(cyan(' \__.--\'`"-. /_ \|\'')) | |
print(cyan(' `"` `~~~---.., |')) | |
print(cyan(' \'SUP, SIR ! \ _.-\'`-.')) | |
print(cyan(' \ \\')) | |
print(cyan(' \'. /')) | |
print(cyan(' `"~"`')) | |
print(cyan('')) | |
def totoro(): | |
""" Totoro VM Details """ | |
env.hosts = ['totoro@totoro', ''] | |
env.vbox = 'Totoro' | |
def prod(): | |
""" Ballball Prod Details """ | |
env.hosts = ['', ''] | |
def staging(): | |
""" Ballball Staging Details """ | |
env.hosts = ['', ''] | |
def stop(): | |
""" Stops the named VM """ | |
require('vbox', provided_by=[totoro, ]) | |
print(cyan('Powering down %s' % (env.vbox,))) | |
local('VBoxManage controlvm "%s" poweroff' % (env.vbox,)) | |
print(cyan('Done ...?')) | |
def start(): | |
""" Starts the named VM """ | |
require('vbox', provided_by=[totoro, ]) | |
print(cyan('Starting up %s' % (env.vbox,))) | |
local('VBoxHeadless --startvm "%s" --vrde off &' % (env.vbox,)) | |
print(cyan('Done ...?')) | |
def allvms(): | |
""" List all VMs on this computer """ | |
print(cyan('All VMs registered on this computer: -')) | |
local('VBoxManage list vms') | |
print(cyan('Done ...?')) | |
def runningvms(): | |
""" List all VMs currently running on this computer """ | |
print(cyan('All VMs currently running on this computer: -')) | |
local('VBoxManage list runningvms') | |
print(cyan('Done ...?')) | |
def bootandroid(): | |
""" Boots AVD API level 18 """ | |
print(cyan('Launching the AVD Smartphone, API version 18')) | |
local('emulator -avd Smartphone18') | |
print(green('Done..?')) | |
def add_key(): | |
""" This will add a key file to the authorized_keys file of the specified server """ | |
require('hosts', provided_by=[totoro, prod, staging, ]) | |
print(cyan('Adding key to host')) | |
run('echo "YOUR_KEY_HERE" >> ~/.ssh/authorized_keys') | |
run('echo "" >> ~/.ssh/authorized_keys') | |
print(green('Done ...?')) | |
def check_key(): | |
""" Cats the authorized_keys file on the specified server """ | |
require('hosts', provided_by=[totoro, prod, staging, ]) | |
print(cyan('Checking authorized_keys on host')) | |
run('cat ~/.ssh/authorized_keys') | |
print(green('Done ...?')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment