]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Adding and using snippets/tpl.450.puppet.sh
authorFrank Brehm <frank.brehm@pixelpark.com>
Fri, 19 Jun 2020 11:17:34 +0000 (13:17 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Fri, 19 Jun 2020 11:17:34 +0000 (13:17 +0200)
kickstart/template-centos8.ks
snippets/tpl.450.puppet.sh [new file with mode: 0644]

index 6902a616d4997e536b6779845c45fb3bb5d5bcca..528a16c84da77e2ecca00df53b739aa1b6872971 100644 (file)
@@ -227,6 +227,11 @@ echo
 echo "Using snippet $chrony_snippet"
 $SNIPPET($chrony_snippet)
 
+#set $puppet_snippet = "per_status/" + $SYSTEM_STATUS + "/tpl.450.puppet.sh"
+echo
+echo "Using snippet $puppet_snippet"
+$SNIPPET($puppet_snippet)
+
 
 
 
diff --git a/snippets/tpl.450.puppet.sh b/snippets/tpl.450.puppet.sh
new file mode 100644 (file)
index 0000000..26f4839
--- /dev/null
@@ -0,0 +1,106 @@
+## !/bin/bash
+#raw
+
+#-----------------------------------------------------------
+install_puppet() {
+
+    local pplabs_conf_dir="/etc/puppetlabs"
+    local puppet_conf_dir="${pplabs_conf_dir}/puppet"
+    local puppet_conf_file="${puppet_conf_dir}/puppet.conf"
+    local facter_conf_dir="${pplabs_conf_dir}/facter/facts.d"
+
+    echo
+    echo "${HASH_LINE}"
+    echo
+    log "Installing Puppet agent ..."
+
+    echo
+    echo "Creating group puppet ..."
+    groupadd -g 63000 puppet
+    getent group puppet
+
+    echo
+    echo "Creating user puppet ..."
+    useradd -u 63000 -g puppet -d /var/lib/puppet -c "Puppet configuration management" -s /sbin/nologin puppet
+    getent passwd puppet
+    id puppet
+
+    echo
+    echo "Installing puppet package ..."
+    if yum install -y puppet-agent ; then
+        :
+    else
+        echo "[$(date)]: Could not install puppet-agent." | tee -a "${ERROR_POINTER}"
+    fi
+
+    echo
+    echo "Creating config dirs ..."
+    mkdir -pv "${puppet_conf_dir}" "${facter_conf_dir}"
+
+    echo
+    echo "Creating ${puppet_conf_file} ..."
+    cat <<-EOF >"${puppet_conf_file}"
+       [main]
+           ca_ttl = 10y
+       [agent]
+           # The file in which puppetd stores a list of the classes
+           # associated with the retrieved configuratiion.  Can be loaded in
+           # the separate "puppet" executable using the "--loadclasses"
+           # option.
+           # The default value is '\$confdir/classes.txt'.
+           classfile = \$vardir/classes.txt
+
+           environment  = production
+           report       = true
+           pluginsync   = true
+           splay        = true
+           use_srv_records  = true
+           srv_domain       = pixelpark.info
+           pluginsource     = puppet:///plugins
+           pluginfactsource = puppet:///pluginfacts
+
+       EOF
+
+    echo
+    echo "Creating ${facter_conf_dir}/customer.yaml"
+    cat <<-EOF >"${facter_conf_dir}/customer.yaml"
+       ---
+       customer: pixelpark
+       EOF
+
+    echo
+    echo "Creating ${facter_conf_dir}/host.yaml"
+    cat <<-EOF >"${facter_conf_dir}/host.yaml"
+       ---
+       pp_purpose: Unknown
+       pp_location: L105
+       pp_owner: Pixelpark AG
+       pp_contact: 8x5@pixelpark.com
+       pp_zonehost: VMWare
+       EOF
+
+    echo
+    echo "Creating ${facter_conf_dir}/tier.yaml"
+    cat <<-EOF >"${facter_conf_dir}/tier.yaml"
+       ---
+       tier: production
+       EOF
+
+    echo
+    echo "Creating ${facter_conf_dir}/role.yaml"
+    cat <<-EOF >"${facter_conf_dir}/role.yaml"
+       ---
+       role: default
+       EOF
+
+    echo
+    echo "Disabling service puppet ..."
+    systemctl disable puppet
+
+}
+
+install_puppet
+
+
+#end raw
+## vim: ts=4 et list