Last active
March 3, 2017 17:41
-
-
Save antriver/a38e8b18c3e491b5fd5caf1393a98ca4 to your computer and use it in GitHub Desktop.
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 | |
# Use this: | |
# export hostname=hello.world.com | |
# wget -O - https://gist.github.com/antriver/a38e8b18c3e491b5fd5caf1393a98ca4/raw | bash | |
# | |
# Use this script on a clean server to setup Puppet and then provision the server | |
# depending on its hostname. See instructions in README.md for usage. | |
# | |
# - Installs git (it already comes with 16.04 though!) | |
# - Installs puppet (available by default on 16.04) | |
# - Clones mainifests repo to /var/puppet | |
# - Runs apply.sh | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
export DEBIAN_FRONTEND=noninteractive | |
apt-get -y update | |
apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade | |
apt-get -y install software-properties-common python-software-properties | |
# Install git | |
apt-get -y install git | |
which git | |
`which git` --version | |
if which git >/dev/null; then | |
echo "git is installed"; | |
else | |
echo "git isn't installed"; | |
exit 1 | |
fi | |
# Install puppet | |
apt-get -y install puppet-common | |
which puppet | |
`which puppet` --version | |
if which puppet >/dev/null; then | |
echo "puppet is installed"; | |
else | |
echo "puppet isn't installed"; | |
exit 1 | |
fi | |
# Clone manifests | |
mkdir /var/puppet | |
cd /var/puppet | |
git clone https://[email protected]/antriver/tmd-puppet.git . | |
# Set hostname if given | |
if [ $hostname ] | |
then | |
./set-hostname.sh $hostname | |
fi | |
# Run puppet apply | |
./apply.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment