pax_global_header00006660000000000000000000000064152114527410014514gustar00rootroot0000000000000052 comment=52b1829396a5debaa972784f5f933d6cb56e0afd README.md000066400000000000000000000240151521145274100123410ustar00rootroot00000000000000# Sparky_Chrony Sparky test for chrony - https://docs.rockylinux.org/guides/automation/configuring_chrony/ # Report example ``` ^@18:45:31 :: [repository] - index updated from http://sparrowhub.io/repo/api/v1/index run stage: use-case *** Sparky Rocky Version: 0.1.7 [task run: task.bash - create directory scm] [task stdout] 18:45:34 :: directory path: scm 18:45:34 :: directory owner: 18:45:34 :: directory group: 18:45:34 :: directory access rights: drwxr-xr-x [task run: task.bash - bash: echo OK] [task stdout] 18:45:38 :: OK [task run: task.bash - bash: sudo dnf install -y python3-pip] [task stdout] 18:45:42 :: Last metadata expiration check: 0:25:32 ago on Sun 07 Jun 2026 06:20:10 PM UTC. 18:45:42 :: Package python3-pip-23.3.2-11.el10_2.noarch is already installed. 18:45:42 :: Dependencies resolved. 18:45:42 :: Nothing to do. 18:45:42 :: Complete! [task run: task.bash - rl-releasever] [task stdout] 18:45:44 :: Switching all rocky repo files to use baseurl 18:45:44 :: Setting releasever to 10.2 18:45:44 :: Setting contentdir to stg/rocky >>> GET http://10.0.2.2:4000/file/sparky-rocky/eypdujofnmsczqvrixga.2463298/use_case_repo.tar [task run: task.bash - bash: unpack use_case_repo.tar] [task stdout] 18:45:46 :: total 28 18:45:46 :: -rw-r--r--. 1 admin admin 25 Jun 7 18:44 main.raku 18:45:46 :: -rw-r--r--. 1 admin admin 108 Jun 7 18:44 README.md 18:45:46 :: drwxr-xr-x. 3 admin admin 21 Jun 7 18:44 tasks 18:45:46 :: -rw-r--r--. 1 admin admin 20480 Jun 7 18:45 use_case_repo.tar load scenario from main.raku [task run: task.bash - tasks/install] [task stdout] 18:45:47 :: Updating system packages... 18:45:48 :: Rocky Linux 10.2 - BaseOS 56 kB/s | 4.3 kB 00:00 18:45:48 :: Rocky Linux 10.2 - AppStream 37 kB/s | 4.3 kB 00:00 18:45:48 :: Rocky Linux 10.2 - Extras 10 kB/s | 3.1 kB 00:00 18:45:48 :: Dependencies resolved. 18:45:48 :: Nothing to do. 18:45:48 :: Complete! 18:45:48 :: === end === 18:45:48 :: Installing chrony... 18:45:49 :: Last metadata expiration check: 0:00:01 ago on Sun 07 Jun 2026 06:45:48 PM UTC. 18:45:49 :: Package chrony-4.8-2.el10.x86_64 is already installed. 18:45:49 :: Dependencies resolved. 18:45:49 :: Nothing to do. 18:45:49 :: Complete! 18:45:49 :: === end === 18:45:49 :: Starting chronyd service... 18:45:49 :: === end === 18:45:49 :: Verifying chronyd is enabled at boot... 18:45:49 :: enabled 18:45:49 :: === end === 18:45:49 :: Checking chronyd service status... 18:45:49 :: ● chronyd.service - NTP client/server 18:45:49 :: Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; preset: enabled) 18:45:49 :: Active: active (running) since Sun 2026-06-07 18:20:10 UTC; 25min ago 18:45:49 :: Invocation: 3e65eb2eb90445f2a8650e1597e56ca7 18:45:49 :: Docs: man:chronyd(8) 18:45:49 :: man:chrony.conf(5) 18:45:49 :: Main PID: 29690 (chronyd) 18:45:49 :: Tasks: 1 (limit: 34966) 18:45:49 :: Memory: 1008K (peak: 2.9M) 18:45:49 :: CPU: 63ms 18:45:49 :: CGroup: /system.slice/chronyd.service 18:45:49 :: └─29690 /usr/sbin/chronyd -n -F 2 18:45:49 :: 18:45:49 :: Jun 07 18:20:10 localhost systemd[1]: Starting chronyd.service - NTP client/server... 18:45:49 :: Jun 07 18:20:10 localhost chronyd[29690]: chronyd version 4.8 starting (+CMDMON +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +NTS +SECHASH +IPV6 +DEBUG) 18:45:49 :: Jun 07 18:20:10 localhost chronyd[29690]: Frequency -36.423 +/- 1.131 ppm read from /var/lib/chrony/drift 18:45:49 :: Jun 07 18:20:10 localhost chronyd[29690]: Loaded seccomp filter (level 2) 18:45:49 :: Jun 07 18:20:10 localhost systemd[1]: Started chronyd.service - NTP client/server. 18:45:49 :: Jun 07 18:20:15 localhost chronyd[29690]: Selected source 162.159.200.1 (2.rocky.pool.ntp.org) 18:45:49 :: === end === 18:45:49 :: Configuring chrony... 18:45:49 :: # Use public servers from the pool.ntp.org project 18:45:49 :: server 0.rocky.pool.ntp.org iburst 18:45:49 :: server 1.rocky.pool.ntp.org iburst 18:45:49 :: server 2.rocky.pool.ntp.org iburst 18:45:49 :: server 3.rocky.pool.ntp.org iburst 18:45:49 :: 18:45:49 :: # Record the rate at which the system clock gains/losses 18:45:49 :: driftfile /var/lib/chrony/drift 18:45:49 :: 18:45:49 :: # Allow the system clock to be stepped in the first three updates 18:45:49 :: # if its offset is larger than 1 second 18:45:49 :: makestep 1.0 3 18:45:49 :: 18:45:49 :: # Enable kernel synchronization of the real-time clock (RTC) 18:45:49 :: rtcsync 18:45:49 :: 18:45:49 :: # Enable hardware timestamping on all interfaces that support it 18:45:49 :: #hwtimestamp * 18:45:49 :: 18:45:49 :: # Increase the minimum number of selectable sources required to adjust 18:45:49 :: # the system clock 18:45:49 :: #minsources 2 18:45:49 :: 18:45:49 :: # Allow NTP client access from local network 18:45:49 :: #allow 192.168.0.0/16 18:45:49 :: 18:45:49 :: # Serve time even if not synchronized to a time source 18:45:49 :: #local stratum 10 18:45:49 :: 18:45:49 :: # Specify file containing keys for NTP authentication 18:45:49 :: #keyfile /etc/chrony.keys 18:45:49 :: 18:45:49 :: # Specify directory for log files 18:45:49 :: logdir /var/log/chrony 18:45:49 :: 18:45:49 :: # Select which information is logged 18:45:49 :: #log measurements statistics tracking 18:45:49 :: === end === 18:45:49 :: Restarting chronyd service... 18:45:49 :: === end === 18:45:59 :: Checking chrony sources... 18:45:59 :: 18:45:59 :: .-- Source mode '^' = server, '=' = peer, '#' = local clock. 18:45:59 :: / .- Source state '*' = current best, '+' = combined, '-' = not combined, 18:45:59 :: | / 'x' = may be in error, '~' = too variable, '?' = unusable. 18:45:59 :: || .- xxxx [ yyyy ] +/- zzzz 18:45:59 :: || Reachability register (octal) -. | xxxx = adjusted offset, 18:45:59 :: || Log2(Polling interval) --. | | yyyy = measured offset, 18:45:59 :: || \ | | zzzz = estimated error. 18:45:59 :: || | | \ 18:45:59 :: MS Name/IP address Stratum Poll Reach LastRx Last sample 18:45:59 :: =============================================================================== 18:45:59 :: ^- ns2.fortrockdc.com 2 6 17 3 +13us[ -130us] +/- 46ms 18:45:59 :: ^* time.ecansol.net 1 6 17 3 +2135us[+1991us] +/- 14ms 18:45:59 :: ^- 66.42.71.197.vultruserco> 2 6 17 3 -2129us[-2273us] +/- 45ms 18:45:59 :: ^+ romyilano.com 2 6 17 4 -1893us[-2037us] +/- 12ms 18:45:59 :: === end === 18:45:59 :: Checking chrony tracking... 18:45:59 :: Reference ID : D842302A (time.ecansol.net) 18:45:59 :: Stratum : 2 18:45:59 :: Ref time (UTC) : Sun Jun 07 18:45:56 2026 18:45:59 :: System time : 0.000136068 seconds slow of NTP time 18:45:59 :: Last offset : -0.000143585 seconds 18:45:59 :: RMS offset : 0.000143585 seconds 18:45:59 :: Frequency : 36.250 ppm slow 18:45:59 :: Residual freq : +2.361 ppm 18:45:59 :: Skew : 0.205 ppm 18:45:59 :: Root delay : 0.028606635 seconds 18:45:59 :: Root dispersion : 0.000162517 seconds 18:45:59 :: Update interval : 2.0 seconds 18:45:59 :: Leap status : Normal 18:45:59 :: === end === 18:45:59 :: Checking chrony activity... 18:45:59 :: 200 OK 18:45:59 :: 4 sources online 18:45:59 :: 0 sources offline 18:45:59 :: 0 sources doing burst (return to online) 18:45:59 :: 0 sources doing burst (return to offline) 18:45:59 :: 0 sources with unknown address 18:45:59 :: === end === 18:45:59 :: Verifying time synchronization... 18:45:59 :: Local time: Sun 2026-06-07 18:45:59 UTC 18:45:59 :: Universal time: Sun 2026-06-07 18:45:59 UTC 18:45:59 :: RTC time: Sun 2026-06-07 18:45:59 18:45:59 :: Time zone: UTC (UTC, +0000) 18:45:59 :: System clock synchronized: yes 18:45:59 :: NTP service: active 18:45:59 :: RTC in local TZ: no 18:45:59 :: === end === 18:45:59 :: Checking synchronization status... 18:45:59 :: try: 1, refid: D842302A, correction: 0.000135855, skew: 0.205 18:45:59 :: === end === [task check] True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True True --- ```main.raku000066400000000000000000000000311521145274100126620ustar00rootroot00000000000000task-run "tasks/install";tasks/000077500000000000000000000000001521145274100122055ustar00rootroot00000000000000tasks/install/000077500000000000000000000000001521145274100136535ustar00rootroot00000000000000tasks/install/task.bash000066400000000000000000000047211521145274100154600ustar00rootroot00000000000000#!/bin/bash set -e # Update system echo "Updating system packages..." sudo dnf update -y echo "=== end ===" # Install chrony echo "Installing chrony..." sudo dnf install -y chrony echo "=== end ===" # Start and enable chronyd service echo "Starting chronyd service..." sudo systemctl start chronyd sudo systemctl enable chronyd echo "=== end ===" # Verify chronyd is enabled at boot echo "Verifying chronyd is enabled at boot..." sudo systemctl is-enabled chronyd echo "=== end ===" # Check chronyd service status echo "Checking chronyd service status..." sudo systemctl status chronyd --no-pager echo "=== end ===" # Configure chrony (command outputs conf content, no separate check needed) echo "Configuring chrony..." sudo tee /etc/chrony.conf << 'EOF' # Use public servers from the pool.ntp.org project server 0.rocky.pool.ntp.org iburst server 1.rocky.pool.ntp.org iburst server 2.rocky.pool.ntp.org iburst server 3.rocky.pool.ntp.org iburst # Record the rate at which the system clock gains/losses driftfile /var/lib/chrony/drift # Allow the system clock to be stepped in the first three updates # if its offset is larger than 1 second makestep 1.0 3 # Enable kernel synchronization of the real-time clock (RTC) rtcsync # Enable hardware timestamping on all interfaces that support it #hwtimestamp * # Increase the minimum number of selectable sources required to adjust # the system clock #minsources 2 # Allow NTP client access from local network #allow 192.168.0.0/16 # Serve time even if not synchronized to a time source #local stratum 10 # Specify file containing keys for NTP authentication #keyfile /etc/chrony.keys # Specify directory for log files logdir /var/log/chrony # Select which information is logged #log measurements statistics tracking EOF echo "=== end ===" # Restart chronyd to apply configuration echo "Restarting chronyd service..." sudo systemctl restart chronyd echo "=== end ===" # Wait for chrony to stabilize (silent) sleep 10 # Check chrony sources echo "Checking chrony sources..." sudo chronyc sources -v echo "=== end ===" # Check chrony tracking echo "Checking chrony tracking..." sudo chronyc tracking echo "=== end ===" # Check chrony activity echo "Checking chrony activity..." sudo chronyc activity echo "=== end ===" # Verify time synchronization echo "Verifying time synchronization..." timedatectl status echo "=== end ===" # Check if chrony is synchronized echo "Checking synchronization status..." sudo chronyc waitsync 10 echo "=== end ==="tasks/install/task.check000066400000000000000000000216431521145274100156220ustar00rootroot00000000000000between: { Updating \s system \s packages } { \=\=\= \s end \s \=\=\= } ~regexp: Dependencies \s resolved generator: < \d+ \. \d+ generator: <= 1).lower()} Package operations completed (count: {state.get('packages_installed', 0)})") print(f"assert: {str(state.get('chrony_installed', False)).lower()} Chrony package installed") print(f"assert: {str(state.get('chronyd_is_enabled', False)).lower()} Chronyd service verified enabled via systemctl is-enabled") print(f"assert: {str(state.get('chronyd_loaded', False)).lower()} Chronyd service unit loaded") print(f"assert: {str(state.get('chronyd_active_running', False)).lower()} Chronyd service is active and running") # Count source records directly from the array sources = state.get('source_matches', []) print(f"assert: {str(len(sources) == 4).lower()} Exactly 4 time sources detected (found {len(sources)})") print(f"assert: {str(state.get('tracking_reference_id', False)).lower()} Tracking Reference ID present") print(f"assert: {str(state.get('tracking_stratum', False)).lower()} Tracking Stratum present") print(f"assert: {str(state.get('tracking_ref_time', False)).lower()} Tracking Reference time present") print(f"assert: {str(state.get('tracking_system_time', False)).lower()} Tracking System time present") print(f"assert: {str(state.get('tracking_last_offset', False)).lower()} Tracking Last offset present") print(f"assert: {str(state.get('tracking_rms_offset', False)).lower()} Tracking RMS offset present") print(f"assert: {str(state.get('tracking_frequency', False)).lower()} Tracking Frequency present") print(f"assert: {str(state.get('sources_online', False)).lower()} Online sources detected (exactly 4)") print(f"assert: {str(state.get('sources_offline_count', False)).lower()} Offline sources count shown") print(f"assert: {str(state.get('sources_burst', False)).lower()} Burst sources shown") print(f"assert: {str(state.get('timezone_configured', False)).lower()} System timezone configured") print(f"assert: {str(state.get('ntp_service_active', False)).lower()} NTP service active") print(f"assert: {str(state.get('clock_synchronized', False)).lower()} System clock synchronized") CODE