-
Notifications
You must be signed in to change notification settings - Fork 9
/
provision
executable file
·43 lines (32 loc) · 1.18 KB
/
provision
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
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bash
set -e # exit on error
set -v # be verbose.
# use this as the boot strap script
# Assumes that salt is already installed, and that there script is trusted.
# It pulls the latest code from master and runs that.
# every thing is assumed to be running as root.
cd /opt
rm -rf magudi
rm -rf pillar
mkdir -p magudi
mkdir -p pillar
# download provisioning code.
wget -qO- https://github.com/pythonindia/magudi/archive/master.tar.gz | tar xvz -C /opt/magudi --strip-components 1
# $PILLAR_GIT_URL should be available in the environment. (may be? /etc/environment)
git archive --remote=ssh://$PILLAR_GIT_URL --format=tgz master | tar xvz -C /opt/pillar
# if salt is not installed, uncomment the following line.
# wget -O - https://bootstrap.saltstack.com | sh
# run salt-call/provision.
mkdir -p /srv
ln -sf /opt/magudi/salt/roots /srv/salt
ln -sf /opt/pillar /srv/pillar
if [ "$1" = "--debug" ]; then
LOG_LEVEL="debug"
else
LOG_LEVEL="warning" # The default
fi
salt-call --local state.highstate -l $LOG_LEVEL
# Ensure that next run will have the updated version
# of the this file. Self updating!!!
cp /opt/magudi/provision /usr/bin/provision
cd # go back to the home directory.