diff --git a/roles/openvpn/templates/announcer b/roles/openvpn/templates/announcer index 9c027cebe..824a43ba4 100755 --- a/roles/openvpn/templates/announcer +++ b/roles/openvpn/templates/announcer @@ -1,17 +1,18 @@ #!/bin/bash -x # Small daemon to identify this machine to the OpenVPN server -# local_vars.yml code from /usr/bin/iiab-support and /usr/bin/iiab-gen-iptables +# SEE /usr/bin/iiab-support for local_vars.yml var extraction explanation -# Empty string, worst case, e.g. whether var is set to "" (or not set at all!) +# EMULATE ANSIBLE: but additionally Force Empty String Where Nec, e.g. whether +# local_vars.yml sets openvpn_handle to "" (or worst case null, or not at all!) HANDLE=$(grep "^openvpn_handle:\s" /etc/iiab/local_vars.yml | tail -1 | sed "s/^openvpn_handle:\s\+//; s/#.*//; s/\s*$//; s/^\(['\"]\)\(.*\)\1$/\2/") -# Change all spaces to underscores -- same as "s/ /_/g" -# /usr/bin/iiab-support emulates this, to help folks understand -HANDLE=${HANDLE// /_} +# ALSO GO 1 STEP FURTHER THAN ANSIBLE: convert remaining spaces to underscores, +# for OpenVPN server. iiab-support emulates this, to help folks understand. +HANDLE=${HANDLE// /_} # Same as "s/ /_/g" # Likewise empty string is the worst case, e.g. if file doesn't exist. -# If handle is "", OpenVPN server tries to use the 1st 6 chars of UUID +# If $HANDLE is "", OpenVPN server tries to use the 1st 6 chars of UUID, # e.g. e1a3d4 from e1a3d4e2-2d1a-4f37-9ba0-e836d7c8e3ca # SEE "AUGUST 2018 - AUGUST 2021" RECAP ON TOP OF: roles/openvpn/tasks/main.yml UUID=$(cat /etc/iiab/uuid)