Skip to content

Instantly share code, notes, and snippets.

@benders
Forked from intjonathan/pe-3-agent-upgrade.sh
Last active January 3, 2016 06:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benders/8426266 to your computer and use it in GitHub Desktop.
Save benders/8426266 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -ex
wget -O /etc/apt/sources.list https://gist.github.com/benders/8426266/raw/b4969acb524ba727b64cf8eaee7a6a31be8ae6fb/precise-sources.list
apt-get update
wget -O /tmp/pe3-install.sh https://gist.github.com/benders/8426266/raw/b1d4c9b6ea41839b74842f05f2ae9efba7a10394/ubuntu-pe-3-install.sh
bash /tmp/pe3-install.sh
#!/bin/bash
pushd .
cd /tmp/
# Prereqs
sudo apt-get install -y curl libreadline5 virt-what
# Extract the node environment from the hostname
hostname_component=$(hostname -f | sed -E 's/^\w+-(\w+).*/\1/')
case $hostname_component in
staging)
puppetmaster=chi-staging-puppetmaster-1.nr-ops.net
agent_environment=staging
;;
ops)
puppetmaster=chi-staging-puppetmaster-1.nr-ops.net
agent_environment=staging
;;
prod)
puppetmaster=chi-prod-puppetmaster-1.nr-ops.net
agent_environment=production
;;
*)
puppetmaster=chi-staging-puppetmaster-1.nr-ops.net
agent_environment=master
;;
esac
# Set the stomp server fact since PE3 doesn't bother to
cat > /tmp/stomp_server.txt << HERE
fact_stomp_server=${puppetmaster}
fact_is_puppetagent=true
HERE
sudo mkdir -p /etc/puppetlabs/facter/facts.d/
sudo mv /tmp/stomp_server.txt /etc/puppetlabs/facter/facts.d/
sudo chown root:root /etc/puppetlabs/facter/facts.d/stomp_server.txt
# Inject the installer answer file
cat > /tmp/pe.upgrade.answers << HERE
q_all_in_one_install=n
q_database_install=n
q_fail_on_unsuccessful_master_lookup=y
q_agent_environment=${agent_environment}
q_install=y
q_puppet_cloud_install=n
q_puppet_enterpriseconsole_install=n
q_puppet_symlinks_install=y
q_puppetagent_certname=$(hostname -f)
q_puppetagent_install=y
q_puppetagent_server=${puppetmaster}
q_puppetca_install=n
q_puppetdb_install=n
q_puppetmaster_install=n
q_rubydevelopment_install=n
q_run_updtvpkg=n
q_upgrade_install_wrapper_modules=n
q_upgrade_installation=y
q_upgrade_remove_mco_homedir=n
q_vendor_packages_install=n
q_verify_packages=y
HERE
# Fetch the installer
VERSION="3.1.1"
PLATFORM="ubuntu-12.04-amd64"
INSTALLER="puppet-enterprise-$VERSION-$PLATFORM"
curl -o /tmp/pe.tar.gz "https://s3.amazonaws.com/pe-builds/released/${VERSION}/${INSTALLER}.tar.gz"
# Run the install
tar -xzf /tmp/pe.tar.gz
cd $INSTALLER
sudo ./puppet-enterprise-installer -A /tmp/pe.upgrade.answers
popd
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ precise main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ precise universe
deb-src http://us.archive.ubuntu.com/ubuntu/ precise universe
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://us.archive.ubuntu.com/ubuntu/ precise multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ precise multiverse
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu precise-security main restricted
deb-src http://security.ubuntu.com/ubuntu precise-security main restricted
deb http://security.ubuntu.com/ubuntu precise-security universe
deb-src http://security.ubuntu.com/ubuntu precise-security universe
deb http://security.ubuntu.com/ubuntu precise-security multiverse
deb-src http://security.ubuntu.com/ubuntu precise-security multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu precise partner
# deb-src http://archive.canonical.com/ubuntu precise partner
## Uncomment the following two lines to add software from Ubuntu's
## 'extras' repository.
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
# deb http://extras.ubuntu.com/ubuntu precise main
# deb-src http://extras.ubuntu.com/ubuntu precise main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment