]> git.openstreetmap.org Git - chef.git/blob - cookbooks/tools/recipes/default.rb
sotm: Add 2014 static site container
[chef.git] / cookbooks / tools / recipes / default.rb
1 #
2 # Cookbook:: tools
3 # Recipe:: default
4 #
5 # Copyright:: 2011, OpenStreetMap Foundation
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #     https://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19
20 package %w[
21   bash-completion
22   conntrack
23   cron
24   curl
25   dmidecode
26   ethtool
27   iotop
28   iptraf-ng
29   locales-all
30   lsof
31   lsscsi
32   lvm2
33   mtr-tiny
34   numactl
35   pciutils
36   ripgrep
37   rsync
38   rsyslog
39   screen
40   smartmontools
41   strace
42   sysstat
43   systemd-coredump
44   tcpdump
45   usbutils
46   vim
47   xfsprogs
48   zstd
49 ]
50
51 service "rsyslog" do
52   action [:enable, :start]
53   supports :status => true, :restart => true, :reload => true
54 end
55
56 # Install some common tools
57 remote_directory "/usr/local/bin" do
58   source "local-bin"
59   owner "root"
60   group "root"
61   mode "755"
62   files_owner "root"
63   files_group "root"
64   files_mode "755"
65 end
66
67 # Remove some unused and unwanted packages
68 package %w[mlocate whoopsie] do
69   action :purge
70 end
71
72 # Configure cron to run in the local timezone of the machine
73 systemd_service "cron-timezone" do
74   service "cron"
75   dropin "timezone"
76   environment "TZ" => node[:timezone]
77   notifies :restart, "service[cron]"
78   only_if { node[:timezone] }
79 end
80
81 # Configure cron with lower cpu and IO priority
82 if node[:tools][:cron][:load]
83   systemd_service "cron-load" do
84     service "cron"
85     dropin "load"
86     nice node[:tools][:cron][:load][:nice]
87     io_scheduling_class node[:tools][:cron][:load][:io_scheduling_class]
88     io_scheduling_priority node[:tools][:cron][:load][:io_scheduling_priority]
89     notifies :restart, "service[cron]"
90   end
91 end
92
93 # Make sure cron is running
94 service "cron" do
95   action [:enable, :start]
96 end
97
98 # Ubuntu MOTD adverts be-gone
99 template "/etc/default/motd-news" do
100   source "motd-news.erb"
101   owner "root"
102   group "root"
103   mode "644"
104 end