Create a gist now

Instantly share code, notes, and snippets.

@bitprophet /fabfile.py Secret
Created Feb 23, 2012

from fabric.api import env, run
def deploy():
run("whatevs")
# Old way
def live():
env.hosts = ['a', 'b', 'c']
def staging():
env.hosts = ['1', '2']
# invoked as: fab live deploy
# New way
environments = {
'live': {'hosts': ['a', 'b', 'c']},
'staging': {'hosts': ['1', '2']}
}
def environment(name):
env.update(environments[name])
# invoked as: fab environment:live deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment