]> git.openstreetmap.org Git - chef.git/blob - cookbooks/ntp/recipes/default.rb
Update formatting of header comments
[chef.git] / cookbooks / ntp / recipes / default.rb
1 #
2 # Cookbook:: ntp
3 # Recipe:: default
4 #
5 # Copyright:: 2010, OpenStreetMap Foundation.
6 # Copyright:: 2009, Opscode, Inc
7 #
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
11 #
12 #     https://www.apache.org/licenses/LICENSE-2.0
13 #
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
19
20 package %w[
21   chrony
22   tzdata
23 ]
24
25 execute "dpkg-reconfigure-tzdata" do
26   action :nothing
27   command "/usr/sbin/dpkg-reconfigure -f noninteractive tzdata"
28   user "root"
29   group "root"
30 end
31
32 link "/etc/localtime" do
33   to "/usr/share/zoneinfo/#{node[:ntp][:tz]}"
34   owner "root"
35   group "root"
36   notifies :run, "execute[dpkg-reconfigure-tzdata]", :immediately
37 end
38
39 template "/etc/chrony/chrony.conf" do
40   source "chrony.conf.erb"
41   owner "root"
42   group "root"
43   mode 0o644
44   notifies :restart, "service[chrony]"
45 end
46
47 service "systemd-timesyncd" do
48   action [:stop, :disable]
49 end
50
51 service "chrony" do
52   action [:enable, :start]
53 end
54
55 munin_plugin "chrony"