git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/onboarding/puppet.conf.sh
diff options
context:
space:
mode:
Diffstat (limited to 'onboarding/puppet.conf.sh')
-rwxr-xr-xonboarding/puppet.conf.sh20
1 files changed, 19 insertions, 1 deletions
diff --git a/onboarding/puppet.conf.sh b/onboarding/puppet.conf.sh
index 3fcd964..c7dbdcb 100755
--- a/onboarding/puppet.conf.sh
+++ b/onboarding/puppet.conf.sh
@@ -9,12 +9,14 @@ function myhelp {
printf -- '-h;This help\n'
printf -- '--remote,\n'
printf -- '-r;Execute on remote host instead of localhost.\n'
+ printf -- '--skip-warning,\n'
+ printf -- '-s;Skip countdown and warning about adjusting puppet.conf.epp first\n'
printf ';Specify REMOTEHOST for rsync+ssh execution (as you would with rsync and ssh).\n'
) | column -ts\;
printf '\n'
}
-declare EREMOTE=0 RHOST
+declare EREMOTE=0 RHOST WSKIP=0
while [[ $# -gt 0 ]]; do
case "$1" in
'--help'|'-h')
@@ -28,6 +30,10 @@ while [[ $# -gt 0 ]]; do
shift
;;
+ '--skip-warning'|'-s')
+ WSKIP=1
+ shift
+ ;;
*)
myhelp
printf '\033[3m\033[1mWrong parameter:\033[0m "%b"\n' "$1" >&2
@@ -35,8 +41,20 @@ while [[ $# -gt 0 ]]; do
;;
esac
done
+if [ "$WSKIP" -lt 1 ]; then
+ printf '\n\033[3m\033[1mHave you adjusted puppet.conf.epp yet? '
+ # shellcheck disable=SC2016
+ printf ' ($my_server, $my_certname, $my_dns_alt_names)\033[0m\n'
+ printf 'Starting\033[s in ...'
+ for (( i=5;i>0;--i )); do
+ printf '\033[u\033[K in %b...' "$i"
+ sleep 1
+ done
+fi
+printf '\n\n'
MYDIR="$(cd "$(dirname "$0")" && pwd)" || exit 101
if [ "$EREMOTE" -gt 0 ]; then
+ printf '\033[3mCopying files:\033[0m\n'
rsync -auP "${MYDIR}/puppet.conf.epp" "${MYDIR}/puppet.conf.pp" "${RHOST}:/tmp/" || exit 110
ARHOST="$(printf '%b' "$RHOST" | awk -F'@' '{print $NF}')"
printf '\033[3mExecuting "puppet apply" for initial onboarding configuration:\033[0m\n'