1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 03:32:12 +00:00
iiab/roles/openvpn/templates/iiab-remote-on.j2
2019-05-12 00:29:15 -04:00

35 lines
1,019 B
Django/Jinja

#!/bin/bash
# /usr/bin/iiab-remote-on should turn on multiple remote support services like
# OpenVPN and others, for remote support, so they work even after reboot.
echo -e "\n\n\e[44m CONSIDER RUNNING 'iiab-support' INSTEAD \e[0m\n\n"
echo -e 'WARNING: To enable OpenVPN long-term, it'"'"'s recommended you:\n'
echo -e '1) Set these variables in /etc/local/local_vars.yml'
echo -e ' openvpn_install: True'
echo -e ' openvpn_enabled: True'
echo -e ' openvpn_handle: <descriptive-name-for-your-machine>\n'
echo -e '2) Run:'
echo -e ' cd /opt/iiab/iiab'
echo -e ' sudo ./runrole openvpn\n'
# Do nothing if OpenVPN not installed
which openvpn
if [ $? -ne 0 ]; then
echo 'Cannot find the OpenVPN program (openvpn).'
exit 1
fi
systemctl enable openvpn
systemctl start openvpn
sleep 5
ping -c 2 {{ openvpn_server_virtual_ip }} # 10.8.0.1
if [ $? -eq 0 ]; then
echo OpenVPN successfully started.
else
echo OpenVPN failed to contact remote server.
fi