-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfabfile.py
More file actions
32 lines (25 loc) · 931 Bytes
/
fabfile.py
File metadata and controls
32 lines (25 loc) · 931 Bytes
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from fabric.api import env
from fabric.decorators import task
from fabric.operations import run, sudo, put
from fabric.context_managers import cd
env.hosts = ['hansyschmitt.com']
env.user = 'marsam'
env.timeout = 120
env.forward_agent = True
env.use_ssh_config = True
env.workdir = '/opt/rambot'
@task(default=True)
def deploy():
with cd(env.workdir):
put('rambot.private.json', 'rambot.private.json')
run('git pull --rebase')
# -b Berksfile needs to be absolute path
run('/opt/chef/embedded/bin/berks install -b %s/deploy/Berksfile --path=cookbooks' % env.workdir) # nopep8
sudo('chef-solo -c solo.rb -j rambot.private.json')
@task
def bootstrap():
sudo('apt-get install -y libxml2-dev libxslt1-dev')
sudo('wget -O- "https://www.opscode.com/chef/install.sh" | bash')
sudo('/opt/chef/embedded/bin/gem install berkshelf')