Created
September 15, 2014 17:29
-
-
Save mlafeldt/15cb5777e9a854e517c4 to your computer and use it in GitHub Desktop.
Helper script to install a specific version of Puppet
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/sh | |
# Helper script to install a specific version of Puppet | |
# Usage: puppet-installer.sh <distro name> <Puppet version> | |
set -e | |
DISTRO=$1 | |
VERSION=$2 | |
CURRENT=$(apt-cache policy puppet | awk '/Installed:/ {print $2}' 2>/dev/null) | |
if test "$CURRENT" = "$VERSION"; then | |
echo "Puppet version $VERSION already installed." | |
exit 0 | |
fi | |
echo "Removing any Puppet gem installations ..." | |
sudo gem uninstall -a -x puppet facter 2>/dev/null || true | |
echo "Installing Puppet version $VERSION ..." | |
wget -q https://apt.puppetlabs.com/puppetlabs-release-$DISTRO.deb | |
sudo dpkg -i puppetlabs-release-$DISTRO.deb | |
sudo apt-get update | |
sudo apt-get install -y "puppet=$VERSION" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment