#!/bin/sh
set -e

echo "Puppet6 is deprecated in FreeBSD. Use Puppet7." 
exit 1

pkg install -y puppet6 rubygem-ruby-augeas rubygem-rexml

echo '[main]
logdir=/var/log/puppet
vardir=/var/puppet
ssldir=/var/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter
server=puppet2.ams.rtbhouse.net

[agent]
report = true
archive_files = true
runinterval = 10800' > /usr/local/etc/puppet/puppet.conf

puppet_vendor_modules="puppetlabs-augeas_core puppetlabs-cron_core puppetlabs-host_core puppetlabs-mount_core puppetlabs-scheduled_task puppetlabs-sshkeys_core puppetlabs-zfs_core"
vendor_modules_dir="/opt/puppetlabs/puppet/vendor_modules"
mkdir -p $vendor_modules_dir

for puppet_module in $puppet_vendor_modules; do
    puppet module install -i $vendor_modules_dir $puppet_module
  done

mkdir -p /opt/puppet-files

# Wywalamy skrypt - nie bedzie juz potrzebny
rm $0

