2017-05-27 18:09:50 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-06-09 23:25:56 +00:00
|
|
|
# copy var files to /etc/iiab for subsequent use
|
2017-05-27 18:09:50 +00:00
|
|
|
|
|
|
|
#./install-init
|
|
|
|
|
|
|
|
# if not the first run, repo location is here
|
|
|
|
|
2017-06-09 23:25:56 +00:00
|
|
|
if [ -f /etc/iiab/iiab.env ]
|
2017-05-27 18:09:50 +00:00
|
|
|
then
|
2017-06-09 23:25:56 +00:00
|
|
|
. /etc/iiab/iiab.env
|
2017-05-27 18:09:50 +00:00
|
|
|
cd $XSCE_DIR
|
|
|
|
else
|
2017-06-09 23:25:56 +00:00
|
|
|
XSCE_DIR=/opt/schoolserver/iiab
|
|
|
|
mkdir -p /etc/iiab
|
|
|
|
touch /etc/iiab/config_vars.yml
|
2017-05-27 18:09:50 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# don't track vars/local_vars.yml
|
|
|
|
git update-index --assume-unchanged vars/local_vars.yml
|
|
|
|
|
2017-06-09 23:25:56 +00:00
|
|
|
PLAYBOOK="iiab-base.yml"
|
2017-05-27 18:09:50 +00:00
|
|
|
INVENTORY="ansible_hosts"
|
|
|
|
SELINUX_BEFORE=""
|
|
|
|
SELINUX_AFTER=""
|
|
|
|
|
|
|
|
if [ ! -f $PLAYBOOK ]
|
|
|
|
then
|
|
|
|
echo "XSCE Playbook not found."
|
|
|
|
echo "Please run this command from the top level of the git repo."
|
|
|
|
echo "Exiting."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f /etc/selinux/config ]
|
|
|
|
then
|
|
|
|
SELINUX_BEFORE=`cat /etc/selinux/config | gawk -F= '/^SELINUX=/{ print $2 }'`
|
|
|
|
fi
|
|
|
|
|
2017-06-09 23:25:56 +00:00
|
|
|
export ANSIBLE_LOG_PATH="$XSCE_DIR/iiab-install.log"
|
2017-05-27 18:09:50 +00:00
|
|
|
ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local
|
|
|
|
|
|
|
|
if [ -f /etc/selinux/config ]
|
|
|
|
then
|
|
|
|
SELINUX_AFTER=`cat /etc/selinux/config | gawk -F= '/^SELINUX=/{ print $2 }'`
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$SELINUX_BEFORE" != "$SELINUX_AFTER" ]; then
|
|
|
|
echo "Rebooting ..."
|
|
|
|
reboot
|
|
|
|
fi
|