systemd-timesyncd¶
Creates a critical alert if a bootstrap Task failure occurs.
This task renders the Template defined by the Param systemd-timesyncd-template
to the
/etc/systemd/timesyncd.conf.d/
directory and then starts the time service.
!!! note:
The systemd-timesyncd
utility is not a true NTP time service management solution. It
is a lightweight clock synchronization tool that utilizes SNTP (Simple NTP) process to
set the system clock. For more robust use cases for things that require more precise
time clock management, use a real NTP client service like chronyd
or ntpd
.
This task can be disabled from running by setting the systemd-timesyncd-skip
Param to
true
.
By default this task will render the default
defined configuration file for systemd-timesyncd.
To change the config file that is rendered, set the systemd-timesyncd-conf
Param to either
a filename (rendered in to /etc/systemd/timesyncd.conf.d/
) or a fully qualified path/filename.
The default template is defined by the Param systemd-timesyncd-template
. For more complex
configuration changes beside a list of NTP Servers (defined by ntp-servers
Param),
create a new Template on the system with your needs, and define the name of the template
in this Param.
If the ntp-servers
Param is set, then the NTP=
config directive will be used. If it is not
set then the system will fall back to the FallbackNTP=
directive using 0.pool.ntp.org
,
1.pool.ntp.org
, and 2.pool.ntp.org
.
Last, if a TimeZone spec is defined in the timezone
Param, then that will be set prior to
(re)starting the systemd-timesyncd
service. Note that the TimeZone spec must conform to
the systemd
defined TimeZone definitions. If this is defined wrong, the Task will fail
and output the valid usable values. To derive these outside of the Task running, use the
following command:
timedatectl list-timezones
By default this task will attempt to set the Hardware Clock to the System time after the
NTP synchronization has completed. This is controlled by the Param systemd-timesyncd-systohc
.
The default value (true
) will run the following command:
hwclock --systohc
Prior to running the NTP synchronization, the timedatectl option set-local-rtc
will be set
to 0
to prevent problems with reading the RTC in local timezone. This is controlled by the
Param systemd-timesyncd-setlocalrtc
. The default value (true
) runs the following
command:
timedatectl set-local-rtc 0
This Task will take efforts to validate that the host is a SystemD enable host, that the
systemd-timesyncd
Unit is available; and if not, attempt to package install the
systemd-timesyncd
package.
If any of the above tests fails, the task will exit with an error.
If the operator defines a fully qualified directory location, it is the responsibility of
the operator to also ensure that systemd-timesyncd
knows how to find the configuration
file at that location. The default directory is /etc/systemd/timesyncd.conf.d/
and any
file ending in *.conf
will be parsed and processed for configuration files.