]> Frank Brehm's Git Trees - pixelpark/create-terraform.git/commitdiff
Adding parameters --location and --zone to postinstall-scripts/init-puppet
authorFrank Brehm <frank.brehm@pixelpark.com>
Wed, 12 Jan 2022 09:43:37 +0000 (10:43 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Wed, 12 Jan 2022 09:43:37 +0000 (10:43 +0100)
postinstall-scripts/init-puppet

index c094304bd6f957b6021143be415b59e5d8d15223..788e3071b3112b944b50fa039b408ee11ae4d370 100755 (executable)
@@ -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}"