server.rb 1.42 KB
Newer Older
jtimberman's avatar
jtimberman committed
1
2
3
4
#
# Cookbook Name:: rsyslog
# Recipe:: server
#
jtimberman's avatar
jtimberman committed
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
# 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.
#

include_recipe "rsyslog"

22
23
node.set['rsyslog']['server'] = true
node.save unless Chef::Config[:solo]
jtimberman's avatar
jtimberman committed
24

25
directory ::File.dirname(node['rsyslog']['log_dir']) do
jtimberman's avatar
jtimberman committed
26
27
  owner "root"
  group "root"
28
  recursive true
jtimberman's avatar
jtimberman committed
29
30
31
  mode 0755
end

32
directory node['rsyslog']['log_dir'] do
33
34
  owner node['rsyslog']['user']
  group node['rsyslog']['group']
35
36
37
38
39
  mode 0755
end

template "/etc/rsyslog.d/35-server-per-host.conf" do
  source "35-server-per-host.conf.erb"
40
  backup false
jtimberman's avatar
jtimberman committed
41
42
43
44
  variables(
    :log_dir => node['rsyslog']['log_dir'],
    :per_host_dir => node['rsyslog']['per_host_dir']
  )
jtimberman's avatar
jtimberman committed
45
46
  owner "root"
  group "root"
47
  mode 0644
48
  notifies :restart, "service[rsyslog]"
jtimberman's avatar
jtimberman committed
49
50
end

51
52
file "/etc/rsyslog.d/remote.conf" do
  action :delete
53
  backup false
54
  notifies :reload, "service[rsyslog]"
55
  only_if do ::File.exists?("/etc/rsyslog.d/remote.conf") end
56
end