From ddaae72c678cbd9c1ca42b512269acdc17d23173 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 12 Jan 2022 10:43:37 +0100 Subject: [PATCH] Adding parameters --location and --zone to postinstall-scripts/init-puppet --- postinstall-scripts/init-puppet | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/postinstall-scripts/init-puppet b/postinstall-scripts/init-puppet index c094304..788e307 100755 --- a/postinstall-scripts/init-puppet +++ b/postinstall-scripts/init-puppet @@ -21,7 +21,7 @@ NORMAL="" HAS_TTY='y' HAS_COLORS="n" -VERSION="1.3" +VERSION="1.4" BASENAME="$(basename ${0})" BASE_DIR="$(dirname ${0})" @@ -33,6 +33,8 @@ CUSTOMER="pixelpark" OWNER= PURPOSE="Projekt Kunde" CONTACT="8x5@pixelpark.com" +LOCATION="L105 / VMWare" +ZONE="N/A" OS= RELEASE= PKG_NAME="puppet-agent" @@ -197,6 +199,10 @@ usage() { -M|--email MAIL_ADDRESS The E-Mail-Address of the responsible Person or Mailgroup, Default: <${CONTACT}>. + -l|--location LOCATION + The location in the MOTD, Default: '${LOCATION}'. + -z|--zone ZONE_HOST + The containing zone host of this zone, VM or container, Default: '${ZONE}'. --server HOSTADDRESS The hostname or IP address of the Puppetserver to use in the puppet configuration. Might be a loadbalancer IP. @@ -236,9 +242,10 @@ get_options() { local tmp= local base_dir= - local short_options="E:C:p:O:T:R:P:M:dvqhV" + local short_options="E:C:p:O:T:R:P:M:l:z:dvqhV" local long_options="env:,environment:,customer:,hiera-customer:,project:,owner:,tier:,role:," - long_options+="purpose:,server:,ca-server:,email:,debug,verbose,quiet,help,version" + long_options+="purpose:,server:,ca-server:,email:,location:,zone:," + long_options+="debug,verbose,quiet,help,version" set +e tmp=$( getopt -o "${short_options}" --long "${long_options}" -n "${BASENAME}" -- "$@" ) @@ -296,6 +303,16 @@ get_options() { shift shift ;; + -l|--location) + LOCATION="$2" + shift + shift + ;; + -z|--zone) + ZONE="$2" + shift + shift + ;; --server) PUPPET_SERVER="$2" shift @@ -406,6 +423,8 @@ get_options() { Customer project: ${project_out} Owner: ${GREEN}${OWNER}${NORMAL} Contact address: ${GREEN}${CONTACT}${NORMAL} + Location: ${GREEN}${LOCATION}${NORMAL} + Zone: ${GREEN}${ZONE}${NORMAL} Purpose: ${GREEN}${PURPOSE}${NORMAL} EOF @@ -678,10 +697,10 @@ generate_facts() { content=$( cat <<-EOF --- pp_purpose: ${PURPOSE} - pp_location: L105 + pp_location: '${LOCATION}' pp_owner: ${OWNER} pp_contact: ${CONTACT} - pp_zonehost: VMWare + pp_zonehost: '${ZONE}' EOF ) debug "Generatet content of '${yfile}':\n${content}" -- 2.39.5