forked from datagovuk/dgu-vagrant-puppet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
3-puppet-apply.sh
41 lines (34 loc) · 1.35 KB
/
3-puppet-apply.sh
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
#!/bin/bash
echo "data.gov.si install script, part 3 (version 27.5.2016-1)"
#show message on error exit
abort()
{
echo "An error occurred. Exiting..." >&2
#sleep is necessary for tee to finish writing before console is shown, otherwise you do not get the prompt
sleep 1
exit 1;
}
trap 'abort' 0
#exit script on error
set -e
#log stdout and stderr to log as well as stdout
exec &> >(tee -a "log-3-puppet-apply.txt")
#exec 1>log.txt 2>&1
#Run as root when installing on fresh machine
if [ "$EUID" -ne 0 ]
then echo "Run script as 'root' user!"
exit 1
fi
cd /src || ( echo "******ERROR*******: cd /src failed" && false )
source /home/co/.rvm/scripts/rvm || ( echo "******ERROR*******: source /home/co/.rvm/scripts/rvm failed" && false )
/vagrant/puppet/install_puppet_dependancies.sh || ( echo "******ERROR*******: install_puppet_dependencies.sh failed" && false )
source /home/co/.rvm/scripts/rvm ; puppet apply /vagrant/puppet/manifests/site.pp || ( echo "******ERROR*******: puppet apply failed" && false )
trap : 0
echo >&2 '
*** FINISHED WITHOUT ERRORS ***
Please also check Puppet output for errors or warnings. If some
remote package did not install, try first to run the script again
in case it was just due to a sparse connection error.
'
#sleep is necessary for tee to finish writing before console is shown, otherwise you do not get the prompt
sleep 1