misc.rb
1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#
# Author:: Earth U (<sysadmin @ chromedia.com>)
# Cookbook Name:: cfe-server
# Recipes:: misc
#
# Copyright 2017, Chromedia Far East, Inc.
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# 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.
#
node[cookbook_name]['misc']['cronjobs'].each do |cjob|
sched = cjob[:sched].split(' ')
is_enable = cjob.has_key?(:enable) ? cjob[:enable] : true
cron_d cjob[:name] do
command cjob[:command]
minute sched[0]
hour sched[1]
day sched[2]
month sched[3]
weekday sched[4]
mailto cjob[:mailto] || '""'
path '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin'
action( is_enable ? :create : :delete )
end
end
package 'logrotate'
node[cookbook_name]['misc']['logrotatejobs'].each do |ljob|
jname = "#{node[cookbook_name]['misc']['logrotate']['conf_dir']}/"\
"#{ljob[:name]}"
is_enable = ljob.has_key?(:enable) ? ljob[:enable] : true
template jname do
source 'logrotate.erb'
variables(
:path => ljob[:path],
:options => ljob[:options]
)
action( is_enable ? :create : :delete )
end
end
template node[cookbook_name]['misc']['sshd']['conf_path'] do
mode 0644
variables(
:ports => node[cookbook_name]['misc']['sshd']['ports']
)
end
include_recipe 'cfe-simple-iptables'