-
Notifications
You must be signed in to change notification settings - Fork 1
/
fabfile.py
32 lines (26 loc) · 902 Bytes
/
fabfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- coding: utf-8 -*-
"""
Example fabfile.py using fabricawscfn.
"""
from __future__ import print_function
from fabric.api import *
## Import from local dir.
# import sys
# sys.path.append('../fabricawscfn')
from fabricawscfn import *
env.EnvName = 'dev'
@task
def env_on(env_name):
"""
Set environment.(Default dev)
:param env_name: Environment name.
"""
env.EnvName = env_name
# Enable confirmation if environment is production.
if env_name == 'production':
stack_group.need_confirm('Execute task on production?')
# Change to your S3 bucket.
stack_group = StackGroup('crossroad0201-fabricawscfn', 'example/%(EnvName)s', 'templates')\
.define_stack('foo', 'fabricawscfn-%(EnvName)s-foo', 'foo.yaml')\
.define_stack('bar', 'fabricawscfn-%(EnvName)s-bar', 'subdir/bar.yaml', Tags=[{'Key':'example', 'Value':'EXAMPLE'}])\
.generate_task(globals())