forked from XSCE/xsce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runansible
executable file
·43 lines (36 loc) · 928 Bytes
/
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
#!/bin/bash
if [ -f xsce.yml ]
then
PLAYBOOK="xsce.yml"
INVENTORY="ansible_hosts"
CWD=`pwd`
echo "Running local playbooks! "
else
if [ -f /var/local/xsce/xsce.yml ]
then
PLAYBOOK="/var/local/xsce/xsce.yml"
INVENTORY="/var/local/xsce/ansible_hosts"
CWD="/var/local/xsce"
echo "Running rpm provided playbooks ! "
fi
fi
#Domain change
if [ -f /etc/sysconfig/xs_domain_name ]
then
XSDOMAIN=`cat /etc/sysconfig/xs_domain_name`
ARGS="--extra-vars \"xsce_domain=$XSDOMAIN\""
fi
if [ x"$1" != x ]
then
XSDOMAIN=$1
ARGS="--extra-vars \"xsce_domain=$XSDOMAIN\""
fi
if [ "$PLAYBOOK" == "" ]
then
echo "rpm is not installed, and local playbook wasn't found!"
exit
fi
export ANSIBLE_LOG_PATH="xsce-install.log"
ansible -m setup -i $INVENTORY localhost --connection=local >> /dev/null
bash $CWD/roles/common/library/xsce_facts >> $ANSIBLE_LOG_PATH
ansible-playbook -i $INVENTORY $PLAYBOOK ${ARGS} --connection=local