Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
pushd .
cd /tmp/
# Remove PE 2.6.1
curl -o /tmp/pe26.tar.gz "http://chi-boss.newrelic.com/pe-installer/puppet-enterprise-2.6.1-el-6-x86_64.tar.gz"
tar xzf /tmp/pe26.tar.gz
sudo /tmp/puppet-enterprise-2.6.1-el-6-x86_64/puppet-enterprise-uninstaller -p -y
# 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
# Run the install
sudo yum clean all # Had problems with package caches, this clears them up
curl --output pe-3.1.0.tar.gz http://chi-boss.newrelic.com/pe-installer/puppet-enterprise-3.1.0-el-6-x86_64.tar.gz
tar -xzf pe-3.1.0.tar.gz
sudo /tmp/puppet-enterprise-3.1.0-el-6-x86_64/puppet-enterprise-installer -A /tmp/pe.upgrade.answers
popd
echo "Run this on chi-ops-provision-1:
sudo puppet node deactivate `hostname -f`; sudo puppet cert clean `hostname -f`"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.