]> git.openstreetmap.org Git - chef.git/blob - cookbooks/tools/recipes/default.rb
dulcy: move to postgresql 18
[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   rsync
37   rsyslog
38   screen
39   smartmontools
40   strace
41   sysstat
42   systemd-coredump
43   tcpdump
44   usbutils
45   vim
46   xfsprogs
47   zstd
48 ]
49
50 service "rsyslog" do
51   action [:enable, :start]
52   supports :status => true, :restart => true, :reload => true
53 end
54
55 # Install some common tools
56 remote_directory "/usr/local/bin" do
57   source "local-bin"
58   owner "root"
59   group "root"
60   mode "755"
61   files_owner "root"
62   files_group "root"
63   files_mode "755"
64 end
65
66 # Remove some unused and unwanted packages
67 package %w[mlocate whoopsie] do
68   action :purge
69 end
70
71 # Configure cron to run in the local timezone of the machine
72 systemd_service "cron-timezone" do
73   service "cron"
74   dropin "timezone"
75   environment "TZ" => node[:timezone]
76   notifies :restart, "service[cron]"
77   only_if { node[:timezone] }
78 end
79
80 # Configure cron with lower cpu and IO priority
81 if node[:tools][:cron][:load]
82   systemd_service "cron-load" do
83     service "cron"
84     dropin "load"
85     nice node[:tools][:cron][:load][:nice]
86     io_scheduling_class node[:tools][:cron][:load][:io_scheduling_class]
87     io_scheduling_priority node[:tools][:cron][:load][:io_scheduling_priority]
88     notifies :restart, "service[cron]"
89   end
90 end
91
92 # Make sure cron is running
93 service "cron" do
94   action [:enable, :start]
95 end
96
97 # Ubuntu MOTD adverts be-gone
98 template "/etc/default/motd-news" do
99   source "motd-news.erb"
100   owner "root"
101   group "root"
102   mode "644"
103 end