Change logic to deploy `/etc/systemd/timesyncd.conf`.

This commit is contained in:
Kazuhiro MUSASHI 2022-10-01 21:41:52 +09:00
parent 1875e14f29
commit 1943fb5f09
3 changed files with 34 additions and 1 deletions

View File

@ -86,12 +86,25 @@ when "20.04", "22.04"
service 'systemd-timesyncd' do service 'systemd-timesyncd' do
action :enable action :enable
end end
end
case node['platform_version']
when "20.04"
remote_file '/etc/systemd/timesyncd.conf' do remote_file '/etc/systemd/timesyncd.conf' do
owner 'root' owner 'root'
group 'root' group 'root'
mode '0644' mode '0644'
notifies :restart, 'service[systemd-timesyncd]'
end
when "22.04"
remote_file '/etc/systemd/timesyncd.conf' do
owner 'root'
group 'root'
mode '0644'
source 'files/etc/systemd/timesyncd.2204.conf'
notifies :restart, 'service[systemd-timesyncd]' notifies :restart, 'service[systemd-timesyncd]'
end end
end end

View File

@ -0,0 +1,20 @@
# 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. Local configuration
# should be created by either modifying this file, or by creating "drop-ins" in
# the timesyncd.conf.d/ subdirectory. The latter is generally recommended.
# Defaults can be restored by simply deleting this file and all drop-ins.
#
# See timesyncd.conf(5) for details.
[Time]
NTP=192.168.10.1
#FallbackNTP=ntp.ubuntu.com
#RootDistanceMaxSec=5
#PollIntervalMinSec=32
#PollIntervalMaxSec=2048

View File

@ -13,7 +13,7 @@ when "22.04"
group 'root' group 'root'
mode '644' mode '644'
source 'templates/etc/systemd/resolved.conf.2022.erb' source 'templates/etc/systemd/resolved.conf.2204.erb'
variables(dns: node['consul']['dns']) variables(dns: node['consul']['dns'])
notifies :restart, 'service[systemd-resolved]', :immediately notifies :restart, 'service[systemd-resolved]', :immediately