Repository navigation
fix: the time baseline accepts any NTP daemon, not only timesyncd - #5
Merged
Merged
Conversation
`timedatectl set-ntp` switches systemd-timesyncd and nothing else. On a host whose clock ntp, ntpsec, or chrony keeps, timedatectl reports CanNTP=no and NTP=no while NTPSynchronized=yes, so the role called the host drifted: check mode reported "Would enable network time synchronization" and a deploy failed with "Failed to set ntp: NTP not supported". Four of the six atlas-fleet servers (Debian 11 and 12 on ntp/ntpsec) hit it. The role now reads CanNTP, switches NTP on only where systemd-timesyncd is installed, and otherwise requires NTPSynchronized=yes. Check mode warns when nothing keeps time; a deploy that waits 60 seconds without synchronizing fails with a message naming the daemons to check, rather than the retry loop's bare command result. Tests replay the role's when and assert expressions through Ansible's own templating for four host states; the other-daemon case fails on the old role. A check-mode run of this role against all six fleet servers reports changed=0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
timedatectl set-ntponly switches systemd-timesyncd. On a host whose clock is kept by ntp, ntpsec, or chrony, timedatectl reportsCanNTP=no NTP=no NTPSynchronized=yes, and thecloudfall_timerole treated that as drift:Failed to set ntp: NTP not supportedHit on atlas-fleet:
task time:deploy TIME_LIMIT=h2,h3,h4,h5failed on h2. Nothing was changed, since the play runs one host at a time.Fix
CanNTPbefore and afterCanNTP=yes); the baseline assertion requiresNTP=yesonly thereNTPSynchronized=yesCanNTP=noand not synchronized)Installing systemd-timesyncd on those hosts was not an option: it would run beside ntp/ntpsec and fight over the clock.
Test plan
engine/tests/test_time_role.py: replays the role'swhenandassertexpressions through Ansible's own templating for four host states (timesyncd on, timesyncd off, another daemon synchronized, nothing keeps time) in check and live mode; 4 of the 6 tests fail on the old roleuv run pytest(448 passed),ruff,mypy,ansible-lint(production profile),time.yml --syntax-checktask time:checkon atlas-fleet shows changed=0🤖 Generated with Claude Code