Last active
November 16, 2015 12:13
-
-
Save zekefast/e7c33fe3d588fbfd4d49 to your computer and use it in GitHub Desktop.
Enable official puppet repository and install puppet agent on freshly setuped Debian Wheezy systems.
This file contains 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
#!/bin/bash | |
# Before installation read puppet requirements at | |
# http://docs.puppetlabs.com/puppet/latest/reference/system_requirements.html | |
# | |
# Script is based on documentation at follow locations: | |
# - Links: | |
# - http://docs.puppetlabs.com/puppet/4.0/reference/install_linux.html | |
set -e | |
set -o pipefail | |
# Latest list of availables code names look at https://apt.puppetlabs.com/ | |
declare -r COLLECTION="pc1" # Puppet Collection 1 | |
# GOTCHA: it finds out debian realse code name and use it. | |
declare -r CODE_NAME=`awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release` | |
declare -r DOWNLOAD_PATH="/tmp" | |
declare -r PUPPET_ENABLE_REPOSITORY_PACKAGE_NAME="puppetlabs-release-$COLLECTION-$CODE_NAME.deb" | |
declare -r PUPPET_REPOSITORY_PACKAGE_FILE_PATH="$DOWNLOAD_PATH/$PUPPET_ENABLE_REPOSITORY_PACKAGE_NAME" | |
declare -r PUPPET_ENABLE_REPOSITORY_PACKAGE_URL="https://apt.puppetlabs.com/$PUPPET_ENABLE_REPOSITORY_PACKAGE_NAME" | |
declare -r MASTER_PACKAGES="puppetserver" | |
declare -r AGENT_PACKAGES="puppet-agent" | |
echo "Downloading puppet's enable repository package file to $PUPPET_REPOSITORY_PACKAGE_FILE_PATH ... " | |
wget --output-document="$PUPPET_REPOSITORY_PACKAGE_FILE_PATH" "$PUPPET_ENABLE_REPOSITORY_PACKAGE_URL" | |
if [ ! -e "$PUPPET_REPOSITORY_PACKAGE_FILE_PATH" ] ; then | |
echo "No puppet repository installation package($PUPPET_ENABLE_REPOSITORY_PACKAGE_URL) was downloaded." | |
echo "Puppet's enable repository package has not been installed." | |
exit 1 | |
fi | |
dpkg -i "$PUPPET_REPOSITORY_PACKAGE_FILE_PATH" | |
echo "Removing downloaded puppet's enable repository package file($PUPPET_REPOSITORY_PACKAGE_FILE_PATH) ... " | |
rm "$PUPPET_REPOSITORY_PACKAGE_FILE_PATH" | |
apt-get update | |
apt-get install "$AGENT_PACKAGES" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment