Commit 56988138 authored by Ronald Doorn's avatar Ronald Doorn
Browse files

if there are no remote syslog servers, just do local config

parent 7f773f22
......@@ -4,7 +4,7 @@ maintainer_email 'cookbooks@chef.io'
license 'Apache 2.0'
description 'Installs and configures rsyslog'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '2.1.1'
version '2.1.2'
recipe 'rsyslog', 'Installs rsyslog'
recipe 'rsyslog::client', 'Sets up a client to log to a remote rsyslog server'
......
......@@ -65,20 +65,18 @@ unless node['rsyslog']['custom_remote'].first.empty?
rsyslog_servers += node['rsyslog']['custom_remote']
end
if rsyslog_servers.empty?
Chef::Application.fatal!('The rsyslog::client recipe was unable to determine the remote syslog server. Checked both the server_ip attribute and search!')
end
remote_type = node['rsyslog']['use_relp'] ? 'relp' : 'remote'
if !rsyslog_servers.empty?
remote_type = node['rsyslog']['use_relp'] ? 'relp' : 'remote'
template "#{node['rsyslog']['config_prefix']}/rsyslog.d/49-remote.conf" do
source "49-#{remote_type}.conf.erb"
owner 'root'
group 'root'
mode '0644'
variables(servers: rsyslog_servers)
notifies :restart, "service[#{node['rsyslog']['service_name']}]"
only_if { node['rsyslog']['remote_logs'] }
template "#{node['rsyslog']['config_prefix']}/rsyslog.d/49-remote.conf" do
source "49-#{remote_type}.conf.erb"
owner 'root'
group 'root'
mode '0644'
variables(servers: rsyslog_servers)
notifies :restart, "service[#{node['rsyslog']['service_name']}]"
only_if { node['rsyslog']['remote_logs'] }
end
end
file "#{node['rsyslog']['config_prefix']}/rsyslog.d/server.conf" do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment