Skip to content

Instantly share code, notes, and snippets.

@mlafeldt
Created September 15, 2014 17:29
Show Gist options
  • Save mlafeldt/15cb5777e9a854e517c4 to your computer and use it in GitHub Desktop.
Save mlafeldt/15cb5777e9a854e517c4 to your computer and use it in GitHub Desktop.
Helper script to install a specific version of Puppet
#!/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