Skip to content

Instantly share code, notes, and snippets.

@andreyev
Last active April 25, 2017 19:09
Show Gist options
  • Select an option

  • Save andreyev/32d175147f7b31e73d1a2b84880e0906 to your computer and use it in GitHub Desktop.

Select an option

Save andreyev/32d175147f7b31e73d1a2b84880e0906 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Usage: curl https://gist.githubusercontent.com/andreyev/32d175147f7b31e73d1a2b84880e0906/raw/puppet-installer.sh | bash -s -- PUPPETENV
PUPPETENV=$1
which puppet || {
OS_MAJ_VERSION=$(rpm -qa \*-release | grep -Ei "centos" | cut -d"-" -f3)
[[ -z "$OS_MAJ_VERSION" ]] && { echo "Distro not supported"; exit 1;}
yum install -y https://yum.puppetlabs.com/puppetlabs-release-pc1-el-"$OS_MAJ_VERSION".noarch.rpm
yum install -y puppet
}
NOW=$(date +%Y%m%d%H%M%S)
test -s /etc/puppetlabs/puppet/puppet.conf && mv /etc/puppetlabs/puppet/puppet.conf{,-$NOW}
cat << EOF > /etc/puppetlabs/puppet/puppet.conf
[main]
environment = ${PUPPETENV}
server = puppet.adtsys.com.br
EOF
/opt/puppetlabs/bin/puppet agent -t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment