Skip to content

Instantly share code, notes, and snippets.

@LeoAdamek
Created April 18, 2014 20:57
Show Gist options
  • Select an option

  • Save LeoAdamek/11064075 to your computer and use it in GitHub Desktop.

Select an option

Save LeoAdamek/11064075 to your computer and use it in GitHub Desktop.
Foreman Provisioning Template
[main]
vardir = /var/lib/puppet
logdir = /var/log/puppet
rundir = /var/run/puppet
ssldir = \$vardir/ssl
[agent]
pluginsync = true
report = true
ignoreschedules = true
daemon = true
runinterval = 900
certname = <%= @host.certname %>
environment = <%= @host.environment %>
server = <%= @host.puppetmaster %>
#!/bin/bash
# Set Hostname
<% if @host.capabilities.include?(:image) -%>
echo '<%= @host %>' > /etc/hostname
hostname <%= @host %>
cat > /etc/hosts << EOF
<%= snippets 'etc-hosts' %>
EOF
<% end -%>
<% if @host.params['ssh_debug_key'] -%>
echo "Setting up SSH"
echo <%= @host.params['ssh_debug_key'] %> > /root/.ssh/authorized_keys
<% end -%>
# Install puppet
echo "Installing Puppet"
wget https://apt.puppetlabs.com/puppetlabs-release-wheezy.deb -O /tmp/puppetlabs.deb
dpkg -iy /tmp/puppetlabs.deb
apt-get update
apt-get -y install puppet
# Start puppeting
<% if @host.info['classes'].include?('puppet::server') -%>
<%= snippets 'master_bootstrap' %>
<% else -%>
cat > /etc/puppet/puppet.conf << EOF
<%= snippets 'puppet.conf' %>
EOF
echo "Running Puppet Agent"
puppet agent
<% end -%>
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment