From a773b4a1b5e7436aa3859016fce0ee2b119d5555 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sun, 28 Aug 2022 21:37:30 +0900 Subject: [PATCH] Install `systemd-timesyncd` and add its config file: ``` --- a/cookbooks/base/default.rb +++ b/cookbooks/base/default.rb @@ -80,6 +80,20 @@ when "20.04", "22.04" service 'multipath-tools' do action :nothing end + + package 'systemd-timesyncd' + + service 'systemd-timesyncd' do + action :enable + end + + remote_file '/etc/systemd/timesyncd.conf' do + owner 'root' + group 'root' + mode '0644' + + notifies :restart, 'service[systemd-timesyncd]' + end end ``` --- cookbooks/base/default.rb | 14 ++++++++++++++ .../base/files/etc/systemd/timesyncd.conf | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 cookbooks/base/files/etc/systemd/timesyncd.conf diff --git a/cookbooks/base/default.rb b/cookbooks/base/default.rb index 0158d23..86feaa9 100644 --- a/cookbooks/base/default.rb +++ b/cookbooks/base/default.rb @@ -80,6 +80,20 @@ when "20.04", "22.04" service 'multipath-tools' do action :nothing end + + package 'systemd-timesyncd' + + service 'systemd-timesyncd' do + action :enable + end + + remote_file '/etc/systemd/timesyncd.conf' do + owner 'root' + group 'root' + mode '0644' + + notifies :restart, 'service[systemd-timesyncd]' + end end # AWS EC2 Swap Setting: diff --git a/cookbooks/base/files/etc/systemd/timesyncd.conf b/cookbooks/base/files/etc/systemd/timesyncd.conf new file mode 100644 index 0000000..d399529 --- /dev/null +++ b/cookbooks/base/files/etc/systemd/timesyncd.conf @@ -0,0 +1,19 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# Entries in this file show the compile time defaults. +# You can change settings by editing this file. +# Defaults can be restored by simply deleting this file. +# +# See timesyncd.conf(5) for details. + +[Time] +NTP=192.168.10.1 +#FallbackNTP=ntp.ubuntu.com +#RootDistanceMaxSec=5 +#PollIntervalMinSec=32 +#PollIntervalMaxSec=2048