Skip to content

Instantly share code, notes, and snippets.

@brylor
Last active August 29, 2015 14:04
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 brylor/d082e6ddb77749727ddf to your computer and use it in GitHub Desktop.
Save brylor/d082e6ddb77749727ddf to your computer and use it in GitHub Desktop.
import time
from fabric.api import *
env.hosts = ['ubuntu@test-server-01:22']
env.roledefs = {"test":["test-server-01"],
"production":["production-server"]}
@roles("test")
def test():
env.user="ubuntu"
print env.hosts
@roles("production")
def production():
env.user="deploy"
print env.hosts
ubuntu@test-server-01:~/RTV2/rtv2$ fab production
[production-server] Executing task 'production'
['ubuntu@test-server-01:22']
Done.
ubuntu@test-server-01:~/RTV2/rtv2$ fab test
[test-server-01] Executing task 'test'
['ubuntu@test-server-01:22']
Done.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment