default.rb 1.56 KB
Newer Older
jtimberman's avatar
jtimberman committed
1
2
3
4
#
# Cookbook Name:: rsyslog
# Recipe:: default
#
Matt Ray's avatar
Matt Ray committed
5
# Copyright 2009-2013, Opscode, Inc.
jtimberman's avatar
jtimberman committed
6
7
8
9
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
10
#
jtimberman's avatar
jtimberman committed
11
#     http://www.apache.org/licenses/LICENSE-2.0
12
#
jtimberman's avatar
jtimberman committed
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

package "rsyslog" do
  action :install
end

directory "/etc/rsyslog.d" do
  mode 0755
end

28
29
30
31
directory "/var/spool/rsyslog" do
  mode 0755
end

32
33
# Our main stub which then does its own rsyslog-specific
# include of things in /etc/rsyslog.d/*
jtimberman's avatar
jtimberman committed
34
template "/etc/rsyslog.conf" do
35
  source 'rsyslog.conf.erb'
jtimberman's avatar
jtimberman committed
36
  mode 0644
37
  variables(:protocol => node['rsyslog']['protocol'])
38
  notifies :restart, "service[#{node['rsyslog']['service_name']}]"
jtimberman's avatar
jtimberman committed
39
end
40

41
42
43
44
template "/etc/rsyslog.d/50-default.conf" do
  source "50-default.conf.erb"
  backup false
  mode 0644
45
  notifies :restart, "service[#{node['rsyslog']['service_name']}]"
46
end
47

48
49
50
51
52
53
54
# syslog needs to be stopped before rsyslog can be started on RHEL versions before 6.0
if platform_family?('rhel') && node['platform_version'].to_i < 6
  service "syslog" do
    action [:stop, :disable]
  end
end

Tim Smith's avatar
Tim Smith committed
55
service node['rsyslog']['service_name'] do
56
  supports :restart => true, :reload => true, :status => true
57
58
  action [:enable, :start]
end