<%= template_header -%>

node_name        '<%= node['fqdn'] %>'

chef_server_url  '<%= @server_url %>'
client_key       '<%= @client_key %>'

<% if @trusted_certs_dir -%>
trusted_certs_dir '<%= @trusted_certs_dir %>'
<% end -%>
<%- if @verify_ssl == 'all' -%>
# Verify all HTTPS connections
ssl_verify_mode :verify_peer
<%- elsif @verify_ssl == 'chef-server' -%>
# Verify only connections to chef-server
verify_api_cert true
<%- end -%>

validation_client_name '<%= @validation_client_name %>'
validation_key   '<%= @validation_key %>'

log_level        <%= @log_level %>
log_location     <%= @use_syslog?'SyslogLogger.new("chef-client")':'STDOUT' %>

file_backup_path '/var/backups/chef'
file_cache_path  '/var/cache/chef'
pid_file         '/var/run/chef/client.pid'

# configuration for Ohai:
<%- unless @odisable.empty? -%>
<%#   Make sure to write symbols into the configuration file %>
<%-   plugins = @odisable.map { |p| p.capitalize.to_sym } -%>
ohai.disabled_plugins =  <%= plugins %>
<%- end %>
ohai.plugin_path << '<%= @opath %>'

<%= @custom_config -%>

<%= template_header -%>

<%- nodename = @node_name || node['fqdn'] -%>
<%- if nodename
node_name        '<%= nodename %>'

<%- end -%>
chef_server_url  '<%= @server_url %>'
client_key       '<%= @client_key %>'

<% if @trusted_certs_dir -%>
trusted_certs_dir '<%= @trusted_certs_dir %>'
<% end -%>
<%- if @verify_ssl == 'all' -%>
# Verify all HTTPS connections
ssl_verify_mode :verify_peer
<%- elsif @verify_ssl == 'chef-server' -%>
# Verify only connections to chef-server
verify_api_cert true
<%- end -%>

validation_client_name '<%= @validation_client_name %>'
validation_key   '<%= @validation_key %>'

log_level        <%= @log_level %>
log_location     <%= @use_syslog?'SyslogLogger.new("chef-client")':'STDOUT' %>

file_backup_path '/var/backups/chef'
file_cache_path  '/var/cache/chef'
pid_file         '/var/run/chef/client.pid'

# configuration for Ohai:
<%- unless @odisable.empty? -%>
<%#   Make sure to write symbols into the configuration file %>
<%-   plugins = @odisable.map { |p| p.capitalize.to_sym } -%>
ohai.disabled_plugins =  <%= plugins %>
<%- end %>
ohai.plugin_path << '<%= @opath %>'

<%= @custom_config -%>

Make node name configurable and catch empty node['fqdn']
Make node name configurable and catch empty node['fqdn']
