Last active
December 10, 2015 08:08
-
-
Save hingstarne/4405965 to your computer and use it in GitHub Desktop.
Script to install puppet agent on a debian like system via the official repos from puppetlabs
This file contains hidden or 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 | |
# | |
# Script to install puppet agent on a debian like system | |
# Copyright (C) 2012 Arne-Kristian Hingst - All Rights Reserved | |
# Permission to copy and modify is granted under the eupl license | |
# http://ec.europa.eu/idabc/servlets/Docbb6d.pdf?id=31979 | |
# Last revised 12/30/2012 | |
# | |
#Define your puppetmaster here | |
puppetmaster='puppet' | |
# Get distributor id | |
distributorId=$(/usr/bin/lsb_release -i -s) | |
if [ $distributorId == "Debian" ] || [ $distributorId == "Ubuntu" ]; | |
then | |
# Prepare puppetlabs repo | |
codename=$(/usr/bin/lsb_release -c -s) | |
wget http://apt.puppetlabs.com/puppetlabs-release-$codename.deb -o /dev/null \ | |
-O /tmp/puppetlabs-release-$codename.deb | |
dpkg -i /tmp/puppetlabs-release-$codename.deb > /dev/null | |
rm /tmp/puppetlabs-release-$codename.deb | |
apt-get update > /dev/null | |
# Install puppet agent | |
aptitude -y install puppet puppet-common > /dev/null | |
# enable puppet-agent autostart | |
sed -i "s/START=no/START=yes/g" /etc/default/puppet | |
# Some puppet settings | |
echo [agent] >> /etc/puppet/puppet.conf | |
echo server = $puppetmaster >> /etc/puppet/puppet.conf | |
echo report = true >> /etc/puppet/puppet.conf | |
#Startup puppet agent | |
service puppet start > /dev/null | |
else | |
echo "Unsupported operatingsystem\nWill now exit" | |
exit 2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment