forked from khamidou/kite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
32 lines (21 loc) · 939 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
# fabfile for update and deploy
# it's necessary to specify an host
from fabric.api import *
from fabric.contrib.project import rsync_project
from fabric.contrib.files import upload_template
from setup_config import *
PACKAGES = ('rsync', 'puppet')
def update_sources():
rsync_project("~", "../kite", exclude=[".git/", "*.swp", "*.pyc"])
def provision():
cmd = """FACTER_server_name="%s" && export FACTER_server_name && FACTER_user_home_dir=$HOME && export FACTER_user_home_dir && puppet apply $HOME/kite/manifests/server.pp --modulepath=$HOME/kite/puppet_modules""" % env.hosts[0]
sudo(cmd)
def setup():
sudo("apt-get update")
for package in PACKAGES:
sudo('apt-get -y install %s' % package)
update_sources()
provision()
def tighten():
local("ssh-copy-id %s@%s" % (env.user, env.hosts[0]))
sudo("puppet apply $HOME/kite/manifests/sshd.pp --modulepath=$HOME/kite/puppet_modules")