jkirk/ansible-role-base

Base Debian package selection installs ntp

mika opened this issue · 6 comments

mika commented

If systemd-timesyncd, chrony or any other implementation is used (or supposed to be used), executing the jkirk.base ansible module removes those because it installs ntp (without checking if anything else is already used/supposed to be used), which then removes e.g. systemd-timesyncd on Debian/bullseye.

jkirk commented

What about setting a variable base_ntp_client to let us choose which ntp package should be installed? Just created the PR #11. Please have look. Thx!

jkirk commented

Or: we could try to detect the most common ntp packages (i.e. ntp, chrony + systemd-timesyncd), keep the one installed and only else install the given one.

mika commented

I just reviewed #11, thanks for working on that!

Regarding:

Or: we could try to detect the most common ntp packages (i.e. ntp, chrony + systemd-timesyncd), keep the one installed and only else install the given one.

I think it makes sense to use a global default, and for the systems that are supposed to ship something else, we should adjust the configuration accordingly. But too much dynamic behavior might not be worth the trouble, at least yet? :)

jkirk commented

Thx for the review! Full ACK on "too much dynamic behavior might not be worth the trouble, at least yet? :)" 😉

Just another note (to self): As this is (currently) not supported by this role, we should document how to use non-default / local time servers.

For systemd-timesyncd it is /etc/systemd/timesyncd.conf:

[Time]
NTP=ntp1.example.com ntp2.example.com ntp3.example.com ntp4.example.com

For ntp it is /etc/ntp.conf:

pool time.example.com iburst

or

server time.example.com iburst

We use iburst by default. I think it is still ok. From ntp.conf(5):

iburst: When the server is unreachable, send a burst of six packets instead of the usual one. The packet spacing is normally 2 s; [...]

We should use server instead of pool if no round-robin DNS is involved, though.

jkirk commented

After some digging I think we should favor chrony over ntp (from Choosing Between NTP Daemons):

Chrony should be preferred for all systems except for the systems that are managed or monitored by tools that do not support chrony, or the systems that have a hardware reference clock which cannot be used with chrony.

The list in Differences Between ntpd and chronyd is too long to quote.