2019-10-10 05:05:02 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
INVENTORY="ansible_hosts"
|
2019-10-16 08:32:31 +00:00
|
|
|
PLAYBOOK="iiab-from-cmdline.yml"
|
2019-10-10 05:05:02 +00:00
|
|
|
CWD=`pwd`
|
2019-10-24 16:15:25 +00:00
|
|
|
APPS=/etc/iiab/iiab_state.yml
|
2019-10-16 15:37:33 +00:00
|
|
|
ENV=/etc/iiab/iiab.env
|
2019-10-10 05:05:02 +00:00
|
|
|
if [ ! -f $PLAYBOOK ]; then
|
2019-10-16 15:37:33 +00:00
|
|
|
echo -e "\nExiting: IIAB Playbook not found."
|
|
|
|
echo -e "\nPlease run this in /opt/iiab/iiab (top level of the git repo)."
|
2019-10-10 05:05:02 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2019-10-16 15:37:33 +00:00
|
|
|
if [ -f $ENV ]; then
|
|
|
|
STAGE=0
|
|
|
|
if grep -q STAGE= /etc/iiab/iiab.env ; then
|
|
|
|
source /etc/iiab/iiab.env
|
|
|
|
echo -e "\nExtracted STAGE="$STAGE" (counter) from /etc/iiab/iiab.env"
|
|
|
|
if ! [ "$STAGE" -eq "$STAGE" ] 2> /dev/null; then
|
|
|
|
echo -e "\nEXITING: STAGE (counter) value == "$STAGE" is non-integer"
|
|
|
|
exit 1
|
|
|
|
elif [ "$STAGE" -lt 0 ] || [ "$STAGE" -gt 9 ]; then
|
|
|
|
echo -e "\nEXITING: STAGE (counter) value == "$STAGE" is out-of-range"
|
|
|
|
exit 1
|
|
|
|
elif [ "$STAGE" -lt 3 ]; then
|
|
|
|
echo -e "\nEXITING: STAGE (counter) value == "$STAGE""
|
|
|
|
echo -e "\nIIAB stage 3 not complete"
|
|
|
|
echo -e "\nPlease run iiab-install"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo -e "\nEXITING: STAGE (counter) not found"
|
|
|
|
echo -e "\nIIAB not installed"
|
|
|
|
echo -e "\nPlease run iiab-install"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo -e "\nEXITING: /etc/iiab/iiab.env not found"
|
|
|
|
echo -e "\nIIAB not installed"
|
|
|
|
echo -e "\nPlease run iiab-install"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
# workaround for image go away later
|
2019-10-14 20:05:06 +00:00
|
|
|
if grep -q sugar $APPS; then
|
|
|
|
if ! grep -q mongodb $APPS; then
|
|
|
|
echo "mongodb_installed: True" >> $APPS
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-10-10 05:05:02 +00:00
|
|
|
export ANSIBLE_LOG_PATH="$CWD/iiab-configure.log"
|
|
|
|
ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local
|