forked from iiab/iiab
-
Notifications
You must be signed in to change notification settings - Fork 2
/
iiab-configure
executable file
·53 lines (48 loc) · 1.84 KB
/
iiab-configure
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
#!/bin/bash
INVENTORY=ansible_hosts
PLAYBOOK=iiab-from-cmdline.yml
CWD=`pwd`
IIAB_STATE_FILE=/etc/iiab/iiab_state.yml
IIAB_ENV_FILE=/etc/iiab/iiab.env
if [ ! -f $PLAYBOOK ]; then
echo -e "\nEXITING: IIAB Playbook ""$PLAYBOOK"" not found."
echo -e "\nPlease run this in /opt/iiab/iiab (top level of the git repo)."
exit 1
fi
if [ -f $IIAB_ENV_FILE ]; 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
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
export ANSIBLE_LOG_PATH="$CWD/iiab-configure.log"
ansible -m setup -i $INVENTORY localhost ${ARGS} --connection=local | grep python
ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local