Created
July 19, 2013 07:02
-
-
Save marcoleong/6037221 to your computer and use it in GitHub Desktop.
Puppet first provision shell use it by ```
bash -c "$(curl -fsSL https://gist.github.com/marcoleong/6037221/raw)"
```
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
#!/usr/bin/env bash | |
# | |
# This bootstraps Puppet on Ubuntu 12.04 LTS. | |
# | |
set -e | |
# Load up the release information | |
. /etc/lsb-release | |
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 | |
# Do the initial apt-get update | |
echo "Initial apt-get update..." | |
apt-get update >/dev/null | |
# Install wget if we have to (some older Ubuntu versions) | |
echo "Installing wget..." | |
apt-get install -y wget >/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..." | |
apt-get install -y puppet >/dev/null | |
echo "Puppet installed!" | |
echo "Install puppet configuration file" | |
cat <<EOF >/etc/puppet/puppet.conf | |
[main] | |
logdir=/var/log/puppet | |
vardir=/var/lib/puppet | |
ssldir=/var/lib/puppet/ssl | |
rundir=/var/run/puppet | |
factpath=$vardir/lib/facter | |
templatedir=$confdir/templates | |
server=puppet.usj.edu.mo | |
[agent] | |
report = true | |
EOF | |
cat <<EOF >/etc/default/puppet | |
START=yes | |
DAEMON_OPTS="" | |
EOF | |
echo "Restart puppet agent" | |
service puppet restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment