Created
July 7, 2015 16:34
-
-
Save nheath/ee6aaa509b44e7909c96 to your computer and use it in GitHub Desktop.
fabric mixed execution
This file contains hidden or 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
| @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