default.rb 1.67 KB
Newer Older
jtimberman's avatar
jtimberman committed
1 2 3 4
#
# Cookbook Name:: rsyslog
# Recipe:: default
#
5
# Copyright 2009-2011, 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
# 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

24
cookbook_file "#{node["rsyslog"]["defaults_file"]}" do
jtimberman's avatar
jtimberman committed
25
  source "rsyslog.default"
26 27
  owner node['rsyslog']['owner']
  group node['rsyslog']['group']
jtimberman's avatar
jtimberman committed
28 29 30 31
  mode 0644
end

directory "/etc/rsyslog.d" do
32 33
  owner node['rsyslog']['owner']
  group node['rsyslog']['group']
jtimberman's avatar
jtimberman committed
34 35 36
  mode 0755
end

37
directory "/var/spool/rsyslog" do
38 39
  owner node['rsyslog']['user']
  group node['rsyslog']['group']
40 41 42
  mode 0755
end

43 44
# Our main stub which then does its own rsyslog-specific
# include of things in /etc/rsyslog.d/*
jtimberman's avatar
jtimberman committed
45
template "/etc/rsyslog.conf" do
46 47 48
  source 'rsyslog.conf.erb'
  owner node['rsyslog']['owner']
  group node['rsyslog']['group']
jtimberman's avatar
jtimberman committed
49
  mode 0644
50
  variables(:protocol => node['rsyslog']['protocol'])
51
  notifies :restart, 'service[rsyslog]'
jtimberman's avatar
jtimberman committed
52
end
53

54 55 56 57 58 59
template "/etc/rsyslog.d/50-default.conf" do
  source "50-default.conf.erb"
  backup false
  owner node['rsyslog']['owner']
  group node['rsyslog']['group']
  mode 0644
60
end
61

62
service "#{node['rsyslog']['service_name']}" do
63 64 65
  supports :restart => true, :reload => true
  action [:enable, :start]
end