Skip to content

Instantly share code, notes, and snippets.

@mstrauss
Created August 24, 2011 19:20
Show Gist options
  • Save mstrauss/1168934 to your computer and use it in GitHub Desktop.
Save mstrauss/1168934 to your computer and use it in GitHub Desktop.
Bootstrap Puppet on Debian/Ubuntu
#!/bin/sh
# Installs Puppet on a naked Debian Lenny/Squeeze, Ubuntu
GEMS_VERSION=1.8.17
PUPPET_VERSION="~>2.7.0"
if [ -n "$http_proxy" -a -z "$https_proxy" ]; then
echo "Have http_proxy but no https_proxy. Setting https_proxy to ${http_proxy}."
export https_proxy=$http_proxy
fi
cd /usr/local/src
wget http://production.cf.rubygems.org/rubygems/rubygems-${GEMS_VERSION}.tgz
tar -xzf rubygems-${GEMS_VERSION}.tgz
# ssl in order to communicate with the puppet master,
# rdoc to be able to use puppet --help
apt-get install -y ruby libopenssl-ruby rdoc
# check ruby version; we need 1.8.7 at least
ruby -e '`ruby --version` =~ /ruby ([0-9.]+)/; exit 1 if $1 < "1.8.7"' || \
( echo 'Sorry. Need at least ruby 1.8.7' && exit 1 )
# we need a /usr/bin/gem instead of gem1.8 for the gem package provider (in
# Puppet) to work; that's what --no-format-executable is for.
ruby rubygems-${GEMS_VERSION}/setup.rb --no-format-executable
GEM=`which gem`
$GEM install puppet --version=${PUPPET_VERSION} --no-ri --no-rdoc
# creating user/group puppet
groupadd --system puppet
useradd --system -g puppet puppet
echo "Now, on this computer run: 'puppet agent --test'"
echo "On your puppet master execute: 'sudo puppet cert --sign $(hostname -f)'"
echo "Afterwards, again on this machine: 'puppet agent --test'"
@mstrauss
Copy link
Author

call like

export http_proxy=http://10.1.4.2:8080
apt-get install -y curl wget && \
/bin/sh -c "$(curl -x $http_proxy -fsSL https://raw.github.com/gist/1168934)"

@mstrauss
Copy link
Author

mstrauss commented Mar 4, 2012

without proxy:
apt-get install -y curl wget &&
/bin/sh -c "$(curl -fsSL https://raw.github.com/gist/1168934)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment