Skip to content

Instantly share code, notes, and snippets.

@nheath
Created July 7, 2015 16:34
Show Gist options
  • Select an option

  • Save nheath/ee6aaa509b44e7909c96 to your computer and use it in GitHub Desktop.

Select an option

Save nheath/ee6aaa509b44e7909c96 to your computer and use it in GitHub Desktop.
fabric mixed execution
@task(default=True)
def deploy(source):
execute('unique_id')
dest = '/opt/app/{0}'.format(env['unique_id'])
# both of these tasks are decorated with @parallel
execute('sync', source=source, dest='~/app')
execute('install', source="~/app", dest=dest)
# apply following steps serially to each env.host
host = env.host
meta = get_metadata('ip', host)
execute('elb_remove', hosts=host, region=meta['region'], instanceid=meta['id'])
execute('deploy_symlink', hosts=host, source=dest, target='/opt/app')
execute('service_restart', hosts=host, service="app")
execute('elb_add', hosts=host, region=meta['region'], instanceid=meta['id'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment