Project

General

Profile

Download (1.78 KB) Statistics
| Branch: | Tag: | Revision:
<%#
kind: snippet
name: puppet.conf
model: ProvisioningTemplate
snippet: true
description: |
Generates a puppet.conf file which is required for the puppet agent bootstraping.
The puppet server and CA is configured based on the host configuration. It supports
Puppet 5 and newer.
-%>
<%
os_family = @host.operatingsystem.family
os_name = @host.operatingsystem.name

aio_enabled = host_param_true?('enable-puppetlabs-puppet6-repo') || host_param_true?('enable-puppet6') || host_param_true?('enable-puppetlabs-puppet5-repo') || host_param_true?('enable-puppet5')
aio_available = os_family == 'Debian' || os_family == 'Redhat' || os_name == 'SLES'

if os_family == 'Windows'
var_dir = 'C:\ProgramData\PuppetLabs\puppet\cache'
log_dir = 'C:\ProgramData\PuppetLabs\puppet\var\log'
run_dir = 'C:\ProgramData\PuppetLabs\puppet\var\run'
ssl_dir = 'C:\ProgramData\PuppetLabs\puppet\etc\ssl'
else
if @host.operatingsystem.family == 'Freebsd'
var_dir = '/var/puppet'
else
var_dir = '/var/lib/puppet'
end
log_dir = '/var/log/puppet'
run_dir = '/var/run/puppet'
ssl_dir = '\$vardir/ssl'
end
-%>
[main]
<%- unless host_param('dns_alt_names').to_s.empty? -%>
dns_alt_names = <%= host_param('dns_alt_names') %>
<%- end -%>
<% unless aio_enabled && aio_available -%>
vardir = <%= var_dir %>
logdir = <%= log_dir %>
rundir = <%= run_dir %>
ssldir = <%= ssl_dir %>
<% end -%>

[agent]
pluginsync = true
report = true
<%- if host_puppet_ca_server.present? -%>
ca_server = <%= host_puppet_ca_server %>
<%- end -%>
certname = <%= @host.certname %>
<%- if host_puppet_server.present? -%>
server = <%= host_puppet_server %>
<%- end -%>
<%- if host_puppet_environment.present? -%>
environment = <%= host_puppet_environment %>
<%- end -%>
(28-28/45)