#yum install -y "${url}"
+ echo
+ log "Cleaning YUM cache ..."
+ yum clean all
+
+ echo
log "Updating YUM cache ..."
- yum makecache
+ yum makecache fast
+ echo
log "Installing perl-Config-IniFiles.noarch ..."
yum install -y perl-Config-IniFiles.noarch
sleep 3
log "Creating initial /etc/motd ..."
local mk_script=$( mktemp -p /tmp "mk_create_motd.XXXXXXXXXX.ksh" )
wget -O "${mk_script}" --dns-timeout=2 --connect-timeout=3 --read-timeout=3 "${url}"
- ksh "${mk_script}" -i 192.168.88.0/23 \
- -p "Template VM" \
- -l "L105 VMWare" \
- -h "VM x86_64" \
- -o "Pixelpark GmbH" > /etc/motd
+ chmod 0755 "${mk_script}"
+ "${mk_script}" -i 192.168.88.0/23 \
+ -p "Template VM" \
+ -l "L105 VMWare" \
+ -h "VM x86_64" \
+ -o "Pixelpark GmbH" > /etc/motd
rm -fv "${mk_script}"
}
}
+#-----------------------------------------------------------
+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/facter.d"
+
+ echo
+ log "Installing Puppet agent ..."
+ echo
+
+ echo "Creating group puppet ..."
+ groupadd -g 63000 puppet
+ getent group puppet
+
+ 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 ..."
+ yum install -y puppet-agent
+
+ 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"
+ cat <<-EOF >"${facter_conf_dir}/host"
+ ---
+ pp_purpose: Unknown
+ pp_location: L105
+ pp_owner: Pixelpark AG
+ pp_contact: 8x5@pixelpark.com
+ pp_zonehost: Unknown
+ EOF
+
+ echo
+ echo "Creating ${facter_conf_dir}/tier.yaml"
+ cat <<-EOF >"${facter_conf_dir}/tier.yaml"
+ ---
+ tier: production
+ EOF
+
+ echo
+ echo "Enabling service puppet ..."
+ systemctl enable pappet
+
+}
+
#-----------------------------------------------------------
main() {
install_ntp
install_openvm_tools
dist_upgrade
+ install_puppet
tweak_grub