default.rb 1.91 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
# 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.
#

20
package 'rsyslog'
21
package 'rsyslog-relp' if node['rsyslog']['use_relp']
22

Dan Buch's avatar
Dan Buch committed
23
directory "#{node['rsyslog']['config_prefix']}/rsyslog.d" do
24
25
26
  owner 'root'
  group 'root'
  mode  '0755'
jtimberman's avatar
jtimberman committed
27
28
end

29
30
31
32
directory '/var/spool/rsyslog' do
  owner 'root'
  group 'root'
  mode  '0755'
33
34
end

35
36
# Our main stub which then does its own rsyslog-specific
# include of things in /etc/rsyslog.d/*
Dan Buch's avatar
Dan Buch committed
37
template "#{node['rsyslog']['config_prefix']}/rsyslog.conf" do
38
39
40
41
  source  'rsyslog.conf.erb'
  owner   'root'
  group   'root'
  mode    '0644'
42
  notifies :restart, "service[#{node['rsyslog']['service_name']}]"
jtimberman's avatar
jtimberman committed
43
end
44

Dan Buch's avatar
Dan Buch committed
45
template "#{node['rsyslog']['config_prefix']}/rsyslog.d/50-default.conf" do
46
47
48
49
  source  '50-default.conf.erb'
  owner   'root'
  group   'root'
  mode    '0644'
50
  notifies :restart, "service[#{node['rsyslog']['service_name']}]"
51
end
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
55
  service 'syslog' do
56
57
    action [:stop, :disable]
  end
Dan Buch's avatar
Dan Buch committed
58
59
60
61
62
# syslog needs to be stopped before rsyslog can be started on SmartOS
elsif platform_family?('smartos')
  service 'system-log' do
    action :disable
  end
63
64
end

Tim Smith's avatar
Tim Smith committed
65
service node['rsyslog']['service_name'] do
66
  supports :restart => true, :reload => true, :status => true
67
  action   [:enable, :start]
68
end