From 3fea2c1fb917012e2dc0f5cc9c12edd4f3104b31 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Thu, 28 Jan 2021 15:49:46 +0100 Subject: [PATCH] Changing postinstall-scripts/init-puppet to change routing of Puppet agent from SRV record to Loadbalancer IP --- postinstall-scripts/init-puppet | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/postinstall-scripts/init-puppet b/postinstall-scripts/init-puppet index 72b1f9c..3442d9c 100755 --- a/postinstall-scripts/init-puppet +++ b/postinstall-scripts/init-puppet @@ -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 ) -- 2.39.5