Last active
November 8, 2017 13:56
-
-
Save alastori/1cb4aba2a3aee43205bd0b9cee95e561 to your computer and use it in GitHub Desktop.
Bash script to install Puppet via puppetlabs.com YUM public repository in Enterprise Linux 7.x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Bash script to install Puppet Server via puppetlabs.com YUM public repository in Enterprise Linux 7.x | |
#Run this script as root | |
set -e # stop script execution on any error | |
echo "Installing Puppet Server..." | |
#Install Puppet YUM repository | |
rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm | |
#check with: yum repolist enabled | grep "puppetlabs" | |
#Install Puppet Server | |
yum -y install puppetserver | |
#check with: systemctl list-unit-files | grep puppet | |
#Post-install - for details see https://docs.puppet.com/puppet/4.1/install_linux.html | |
##Update localhost file to be Puppet Master host | |
echo '127.0.0.1 puppet puppet.localdomain' >> /etc/hosts | |
###check with: ping -c4 puppet | |
##Change memory footprint used by Puppet Server - update JAVA_ARGS to 1GB | |
sed -i -e 's/Xms2g/Xms1g/g' /etc/sysconfig/puppetserver | |
sed -i -e 's/Xmx2g/Xmx1g/g' /etc/sysconfig/puppetserver | |
###check with: cat /etc/sysconfig/puppetserver | grep JAVA_ARGS | |
###Enabling naïve autosigning. You should never do this in a production deployment. See https://puppet.com/docs/puppet/4.10/ssl_autosign.html | |
echo 'autosign = true' >> /etc/puppetlabs/puppet/puppet.conf | |
#Start Puppet Master and set to restart automatically after reboot | |
systemctl start puppetserver | |
systemctl enable puppetserver | |
#check with: systemctl status puppetserver | |
#Start Puppet Agent and set to restart automatically after reboot | |
systemctl start puppet | |
systemctl enable puppet | |
#check with: systemctl status puppet | |
echo "Puppet Server installed." | |
/opt/puppetlabs/bin/puppetserver --version | |
echo "Puppet (client) installed." | |
/opt/puppetlabs/bin/puppet --version | |
echo "Hiera installed." | |
/opt/puppetlabs/bin/hiera --version | |
echo "Facter installed." | |
/opt/puppetlabs/bin/facter --version | |
echo "Run puppet agent with:" | |
echo " /opt/puppetlabs/bin/puppet agent -t" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment