#!/bin/bash -x
# Bootstrap for Debian 9 stable (stretch)
# Uses distribution-supplied Puppet version (4.8.x)
(
exec 1> >(logger -s -t user-data) 2>&1

export DEBIAN_FRONTEND=noninteractive

apt-get update
apt-get -y upgrade

apt-get install -y puppet ruby ruby-dev zlib1g-dev libxml2-dev gcc make patch gnupg2

gem install pupistry --no-ri --no-rdoc
mkdir -p /etc/pupistry
mkdir -p <%= puppetcode %>
cat > /etc/pupistry/settings.yaml << "EOF"
general:
  app_cache: ~/.pupistry/cache
  s3_bucket: <%= s3_bucket %>
  s3_prefix: <%= s3_prefix %>
  gpg_disable: <%= gpg_disable %>
  gpg_signing_key: <%= gpg_signing_key %>
agent:
  puppetcode: <%= puppetcode %>
  access_key_id: <%= access_key_id %>
  secret_access_key: <%= secret_access_key %>
  region: <%= region %>
  proxy_uri: <%= proxy_uri %>
  daemon_frequency: <%= daemon_frequency %>
  daemon_minimal: <%= daemon_minimal %>
  environment: <%= environment %>
EOF
chmod 700 /etc/pupistry/settings.yaml
chmod 700 <%= puppetcode %>
pupistry apply --verbose

)

Add bootstrap template for Debian-9
Add bootstrap template for Debian-9
