2017-09-11 16:19:55 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-09-03 03:51:28 +00:00
|
|
|
PLAYBOOK="iiab-support.yml"
|
2017-09-11 16:19:55 +00:00
|
|
|
INVENTORY="ansible_hosts"
|
2017-10-24 16:39:49 +00:00
|
|
|
CWD=`pwd`
|
2017-09-11 16:19:55 +00:00
|
|
|
|
2017-10-30 17:57:55 +00:00
|
|
|
export ANSIBLE_LOG_PATH="$CWD/iiab-install.log"
|
|
|
|
|
2018-09-03 03:51:28 +00:00
|
|
|
if [ ! -f $PLAYBOOK ]; then
|
|
|
|
echo -e "\nEXITING: $PLAYBOOK not found.\n"
|
|
|
|
echo -e "Please run this command from /opt/iiab/iiab (top of git repo).\n"
|
|
|
|
exit 1
|
2017-09-11 16:19:55 +00:00
|
|
|
fi
|
|
|
|
|
2019-05-09 23:12:30 +00:00
|
|
|
echo -en "\n\nWhat OpenVPN machine name (openvpn_handle) do you want? "
|
2019-05-09 21:57:44 +00:00
|
|
|
read ans < /dev/tty
|
|
|
|
if [ "$ans" != "" ]; then
|
|
|
|
sed -i -e "s/^openvpn_handle:.*/openvpn_handle: $ans/" /etc/iiab/local_vars.yml
|
2019-05-09 23:12:30 +00:00
|
|
|
echo -e "\nYour machine's openvpn_handle is now set, in /etc/iiab/local_vars.yml\n"
|
2019-05-09 21:57:44 +00:00
|
|
|
else
|
2019-05-09 23:12:30 +00:00
|
|
|
echo -e "\nWARNING: openvpn_handle remains unchanged in /etc/iiab/local_vars.yml\n"
|
2019-05-09 21:57:44 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
sed -i -e "s/^openvpn_install:.*/openvpn_install: True/" /etc/iiab/local_vars.yml
|
|
|
|
sed -i -e "s/^openvpn_enabled:.*/openvpn_enabled: True/" /etc/iiab/local_vars.yml
|
2017-09-11 16:19:55 +00:00
|
|
|
|
2019-05-09 23:49:14 +00:00
|
|
|
echo -e "Now let's (re)install and (re)start OpenVPN...\n"
|
2019-05-09 23:12:30 +00:00
|
|
|
|
2017-09-11 16:19:55 +00:00
|
|
|
ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local
|
2019-05-09 23:12:30 +00:00
|
|
|
|
|
|
|
echo -en "\nYour OpenVPN handle is....... "
|
|
|
|
cat /etc/iiab/openvpn_handle
|
|
|
|
echo -e "\nYour OpenVPN IP address is... $(ip a | grep tun0$ | awk '{print $2}')\n\n"
|