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
```
This commit is contained in:
Kazuhiro MUSASHI 2022-08-28 21:37:30 +09:00
parent 11bdc70327
commit a773b4a1b5
2 changed files with 33 additions and 0 deletions

View File

@ -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:

View File

@ -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