from fabric.api import env, run env.roledefs = { 'web': ['web1', 'web2', 'web3'], 'db': ['db1', 'db2'] } def hello(): run('hostname')