set -e

# Prepare puppetlabs repo
CODENAME=`lsb_release -cs`
wget http://apt.puppetlabs.com/puppetlabs-release-"$CODENAME".deb
dpkg -i puppetlabs-release-"$CODENAME".deb
apt-get update

# Install puppet/facter
apt-get install -y puppet facter
rm -f puppetlabs-release-"$CODENAME".deb

# Disable Puppet agent on systemd
# PuppetLabs has the service disabled per default
if which systemctl >/dev/null; then
  systemctl stop puppet
  systemctl disable puppet
fi

set -e

# Prepare puppetlabs repo
CODENAME=`lsb_release -cs`
if [ "$CODENAME" = "jessie" ]; then
    CODENAME=testing
fi
wget http://apt.puppetlabs.com/puppetlabs-release-"$CODENAME".deb
dpkg -i puppetlabs-release-"$CODENAME".deb
apt-get update

# Install puppet/facter
apt-get install -y puppet facter
rm -f puppetlabs-release-"$CODENAME".deb

# Disable Puppet agent on systemd
# PuppetLabs has the service disabled per default
if which systemctl >/dev/null; then
  systemctl stop puppet
  systemctl disable puppet
fi

Fix PuppetLabs repo for Jessie, since they still only have testing
Fix PuppetLabs repo for Jessie, since they still only have testing
