Skip to content

Instantly share code, notes, and snippets.

@nubzzz
Last active March 1, 2016 17:58
Show Gist options
  • Save nubzzz/8c6c5ba931fe3af92939 to your computer and use it in GitHub Desktop.
Save nubzzz/8c6c5ba931fe3af92939 to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
# This bootstraps Puppet on Debian
set -e
# Remove the cdrom crap from /etc/apt/sources.list
echo "Removing cdrom sources"
echo "deb http://ftp.us.debian.org/debian/ wheezy main
deb-src http://ftp.us.debian.org/debian/ wheezy main
deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main
# wheezy-updates, previously known as 'volatile'
deb http://ftp.us.debian.org/debian/ wheezy-updates main
deb-src http://ftp.us.debian.org/debian/ wheezy-updates main" > /etc/apt/sources.list
# Do the initial apt-get update
echo "Initial apt-get update..."
apt-get update >/dev/null
# Older versions of Debian don't have lsb_release by default, so
# install that if we have to.
which lsb_release || apt-get install -y lsb-release
# Load up the release information
DISTRIB_CODENAME=$(lsb_release -c -s)
REPO_DEB_URL="http://apt.puppetlabs.com/puppetlabs-release-${DISTRIB_CODENAME}.deb"
#--------------------------------------------------------------------
# NO TUNABLES BELOW THIS POINT
#--------------------------------------------------------------------
if [ "$EUID" -ne "0" ]; then
echo "This script must be run as root." >&2
exit 1
fi
# Install wget if we have to (some older Debian versions)
echo "Installing wget, curl, vim, and rsync..."
apt-get install -y wget curl vim rsync >/dev/null
# Install the PuppetLabs repo
echo "Configuring PuppetLabs repo..."
repo_deb_path=$(mktemp)
wget --output-document="${repo_deb_path}" "${REPO_DEB_URL}" 2>/dev/null
dpkg -i "${repo_deb_path}" >/dev/null
apt-get update >/dev/null
# Install Puppet
echo "Installing Puppet..."
DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install puppet >/dev/null
echo "Configuring Puppet..."
echo '[agent]
server = puppet01.sknet.io' >> /etc/puppet/puppet.conf
echo "Puppet installed!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment