diff options
| -rw-r--r-- | onboarding/puppet.conf.epp | 8 | ||||
| -rwxr-xr-x | onboarding/puppet.conf.sh | 20 |
2 files changed, 24 insertions, 4 deletions
diff --git a/onboarding/puppet.conf.epp b/onboarding/puppet.conf.epp index 0905f90..fc2bf73 100644 --- a/onboarding/puppet.conf.epp +++ b/onboarding/puppet.conf.epp @@ -10,14 +10,16 @@ # first run. -%> <% +# The server you intend to use. REQUIRED SETTING. +$my_server = 'puppet.example.com' # If you want to determine the certname manually, do it here. -# If this remains undefined or empty, facts.networking.fqdn will be used. +# If this remains undefined or empty, facts.networking.fqdn will be used +# (so default if unset: FQDN). $my_certname = '' # This should be a comma separated list of values - it's the same in # puppet.conf. puppet.conf will not bear the directive if this is empty. +# (If left empty, NO SANs will be added to the certificate even later on.) $my_dns_alt_names = '' -# The server you intend to use. Has to be set. -$my_server = 'puppet.example.com' -%> # vim:syntax=dosini # File manually created with Puppet. 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' |
