]> Frank Brehm's Git Trees - pixelpark/create-terraform.git/commitdiff
Changing postinstall-scripts/init-puppet to change routing of Puppet agent from SRV...
authorFrank Brehm <frank.brehm@pixelpark.com>
Thu, 28 Jan 2021 14:49:46 +0000 (15:49 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Thu, 28 Jan 2021 14:49:46 +0000 (15:49 +0100)
postinstall-scripts/init-puppet

index 72b1f9ccd9a46d502c6dfae4afb9fd653fff3c12..3442d9cc151c0717d3134ac5fe598d0fde8ce732 100755 (executable)
@@ -21,7 +21,7 @@ NORMAL=""
 HAS_TTY='y'
 HAS_COLORS="n"
 
-VERSION="1.2"
+VERSION="1.3"
 
 BASENAME="$(basename ${0})"
 BASE_DIR="$(dirname ${0})"
@@ -41,6 +41,8 @@ PKG_INSTALLED="n"
 ROLE="base_oel7"
 PROJECT=
 
+PUPPET_SERVER="puppetmaster.pixelpark.com"
+PUPPET_CA_SERVER="puppetca01.pixelpark.com"
 
 #########################################
 # Some often used funktions
@@ -195,6 +197,13 @@ usage() {
                -M|--email MAIL_ADDRESS
                                The E-Mail-Address of the responsible Person
                                or Mailgroup, Default: <${CONTACT}>.
+               --server HOSTADDRESS
+                               The hostname or IP address of the Puppetserver to use
+                               in the puppet configuration. Might be a loadbalancer IP.
+                               Default: '${PUPPET_SERVER}'.
+               --ca-server HOSTADDRESS
+                               The hostname or IP address of the Puppet CA server to use
+                               in the puppet configuration. Default: '${PUPPET_CA_SERVER}'.
                -d|--debug      Debug output (bash -x).
                -v|--verbose    Set verbosity on.
                -q|--quiet      Quiet execution. Mutually exclusive to --verbose.
@@ -229,7 +238,7 @@ get_options() {
     local base_dir=
     local short_options="E:C:p:O:T:R:P:M:dvqhV"
     local long_options="env:,environment:,customer:,hiera-customer:,project:,owner:,tier:,role:,"
-    long_options+="purpose:,email:,debug,verbose,quiet,help,version"
+    long_options+="purpose:,server:,ca-server:,email:,debug,verbose,quiet,help,version"
 
     set +e
     tmp=$( getopt -o "${short_options}" --long "${long_options}" -n "${BASENAME}" -- "$@" )
@@ -287,6 +296,16 @@ get_options() {
                 shift
                 shift
                 ;;
+            --server)
+                PUPPET_SERVER="$2"
+                shift
+                shift
+                ;;
+            --ca-server)
+                PUPPET_CA_SERVER="$2"
+                shift
+                shift
+                ;;
             -d|--debug)
                 DEBUG="y"
                 shift
@@ -611,10 +630,12 @@ generate_puppetconf() {
                    report       = true
                    pluginsync   = true
                    splay        = true
-                   use_srv_records  = true
-                   srv_domain       = pixelpark.info
-                   pluginsource     = puppet:///plugins
-                   pluginfactsource = puppet:///pluginfacts
+                   server       = ${PUPPET_SERVER}
+                   ca_server    = ${PUPPET_CA_SERVER}
+                   use_cached_catalog = false
+                   usecacheonfailure  = false
+                   pluginsource       = puppet:///plugins
+                   pluginfactsource   = puppet:///pluginfacts
                EOF
     )