-
Notifications
You must be signed in to change notification settings - Fork 32
/
runansible
executable file
·66 lines (55 loc) · 1.37 KB
/
runansible
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# copy var files to /etc/xsce for subsequent use
mkdir -p /etc/xsce
if [ ! -f /etc/xsce/config_vars.yml ]; then
echo "{}" > /etc/xsce/config_vars.yml
fi
# if vars/local_vars.yml is missing, put a default one in place
if [ ! -f ./vars/local_vars.yml ]; then
OS=`grep ^ID= /etc/*release|cut -d= -f2`
OS=${OS//\"/}
if [ "$OS" = "debian" ] || [ "$OS" = "raspbian" ]; then
cp ./vars/debian.localvars ./vars/local_vars.yml
else
cp ./vars/centos.localvars ./vars/local_vars.yml
fi
fi
if [ -f /etc/xsce/xsce.env ]
then
. /etc/xsce/xsce.env
cd $XSCE_DIR
else
XSCE_DIR=/opt/schoolserver/xsce
fi
if [ ! -f xsce.yml ]
then
echo "XSCE Playbook not found."
echo "Please run this command from the top level of the git repo."
echo "Exiting."
exit
fi
PLAYBOOK="xsce.yml"
INVENTORY="ansible_hosts"
CWD=`pwd`
echo "Running local playbooks! "
XSDOMAIN=""
# Pass in Existing Domain
if [ -f /etc/sysconfig/xs_domain_name ]
then
XSDOMAIN=`cat /etc/sysconfig/xs_domain_name`
fi
# Or accept Domain on command line
if [ x"$1" != x ]
then
XSDOMAIN=$1
fi
# Pass in git location
if [ x"$XSDOMAIN" != x ]
then
ARGS="--extra-vars '{\"xsce_domain\":\"$XSDOMAIN\"}'"
else
ARGS=""
fi
export ANSIBLE_LOG_PATH="$XSCE_DIR/xsce-install.log"
ansible -m setup -i $INVENTORY localhost --connection=local >> /dev/null
ansible-playbook -i $INVENTORY $PLAYBOOK ${ARGS} --connection=local