Commit 4d7f74fc authored by Jeff Blaine's avatar Jeff Blaine Committed by jtimberman
Browse files

Lots of final cleanup from testing rhel6

parent 90164865
......@@ -20,12 +20,17 @@
include_recipe "rsyslog"
if !node['rsyslog']['server'] and node['rsyslog']['server_ip'].nil? and Chef::Config[:solo]
Chef::Log.info("The rsyslog::client recipe uses search. Chef Solo does not support search.")
Chef::Log.fatal("Chef Solo does not support search, therefore it is a requirement of the rsyslog::client recipe that the attribute 'server_ip' is set when using Chef Solo. 'server_ip' is not set.")
elsif !node['rsyslog']['server']
rsyslog_server = node['rsyslog']['server_ip'] ||
search(:node, node['rsyslog']['server_search']).first['ipaddress'] rescue nil
if rsyslog_server.nil?
raise "The rsyslog::client recipe was unable to determine the remote syslog server. Checked both the server_ip attribute and search()"
end
template "/etc/rsyslog.d/49-remote.conf" do
only_if { node['rsyslog']['remote_logs'] && !rsyslog_server.nil? }
source "49-remote.conf.erb"
backup false
variables(
......@@ -35,13 +40,12 @@ elsif !node['rsyslog']['server']
owner node["rsyslog"]["owner"]
owner node["rsyslog"]["group"]
mode 0644
only_if { node['rsyslog']['remote_logs'] && !rsyslog_server.nil? }
notifies :restart, "service[rsyslog]"
notifies :restart, "service[#{node['rsyslog']['service_name']}]"
end
file "/etc/rsyslog.d/server.conf" do
action :delete
notifies :reload, "service[rsyslog]"
only_if do ::File.exists?("/etc/rsyslog.d/server.conf") end
action :delete
notifies :reload, "service[#{node['rsyslog']['service_name']}]"
end
end
......@@ -48,7 +48,7 @@ template "/etc/rsyslog.conf" do
group node['rsyslog']['group']
mode 0644
variables(:protocol => node['rsyslog']['protocol'])
notifies :restart, 'service[rsyslog]'
notifies :restart, "service[#{node['rsyslog']['service_name']}]"
end
template "/etc/rsyslog.d/50-default.conf" do
......@@ -57,6 +57,7 @@ template "/etc/rsyslog.d/50-default.conf" do
owner node['rsyslog']['owner']
group node['rsyslog']['group']
mode 0644
notifies :restart, "service[#{node['rsyslog']['service_name']}]"
end
service "#{node['rsyslog']['service_name']}" do
......
......@@ -45,12 +45,12 @@ template "/etc/rsyslog.d/35-server-per-host.conf" do
owner node["rsyslog"]["owner"]
owner node["rsyslog"]["group"]
mode 0644
notifies :restart, "service[rsyslog]"
notifies :restart, "service[#{node['rsyslog']['service_name']}]"
end
file "/etc/rsyslog.d/remote.conf" do
action :delete
backup false
notifies :reload, "service[rsyslog]"
notifies :reload, "service[#{node['rsyslog']['service_name']}]"
only_if do ::File.exists?("/etc/rsyslog.d/remote.conf") end
end
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