1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-12 11:12:06 +00:00
iiab/iiab-configure

54 lines
1.8 KiB
Text
Raw Permalink Normal View History

2019-10-10 05:05:02 +00:00
#!/bin/bash
INVENTORY=ansible_hosts
PLAYBOOK=iiab-from-cmdline.yml
2019-10-10 05:05:02 +00:00
CWD=`pwd`
IIAB_STATE_FILE=/etc/iiab/iiab_state.yml
IIAB_ENV_FILE=/etc/iiab/iiab.env
2019-10-10 05:05:02 +00:00
if [ ! -f $PLAYBOOK ]; then
echo -e "\nEXITING: IIAB Playbook ""$PLAYBOOK"" not found."
2019-10-16 15:37:33 +00:00
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
if [ -f $IIAB_ENV_FILE ]; then
2019-10-16 15:37:33 +00:00
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"
2019-10-16 15:37:33 +00:00
if ! [ "$STAGE" -eq "$STAGE" ] 2> /dev/null; then
echo -e "\nEXITING: STAGE (counter) value == ""$STAGE"" is non-integer"
2019-10-16 15:37:33 +00:00
exit 1
elif [ "$STAGE" -lt 0 ] || [ "$STAGE" -gt 9 ]; then
echo -e "\nEXITING: STAGE (counter) value == ""$STAGE"" is out-of-range"
2019-10-16 15:37:33 +00:00
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"
2019-10-16 15:37:33 +00:00
exit 1
fi
else
echo -e "\nEXITING: STAGE (counter) not found"
echo -e "\nIIAB not installed."
echo -e "\nPlease run: ./iiab-install"
2019-10-16 15:37:33 +00:00
exit 1
fi
else
echo -e "\nEXITING: /etc/iiab/iiab.env not found"
echo -e "\nIIAB not installed."
echo -e "\nPlease run: ./iiab-install"
2019-10-16 15:37:33 +00:00
exit 1
fi
cp ./scripts/local_facts.fact /etc/ansible/facts.d/local_facts.fact
# Workaround for (web-published) images; will go away later
if grep -q sugar $IIAB_STATE_FILE && ! grep -q mongodb $IIAB_STATE_FILE; then
echo "mongodb_installed: True" >> $IIAB_STATE_FILE
fi
2019-10-10 05:05:02 +00:00
export ANSIBLE_LOG_PATH="$CWD/iiab-configure.log"
2019-11-04 05:47:44 +00:00
ansible -m setup -i $INVENTORY localhost ${ARGS} --connection=local | grep python
2019-10-10 05:05:02 +00:00
ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local