pax_global_header00006660000000000000000000000064152113330200014500gustar00rootroot0000000000000052 comment=43bddbaf2b330bd48065c66ad13dc67a69b6251b README.md000066400000000000000000000001541521133302000123230ustar00rootroot00000000000000# Sparky_Chronie Sparky test for chrony - https://docs.rockylinux.org/guides/automation/configuring_chrony/main.raku000066400000000000000000000000311521133302000126460ustar00rootroot00000000000000task-run "tasks/install";tasks/000077500000000000000000000000001521133302000121715ustar00rootroot00000000000000tasks/install/000077500000000000000000000000001521133302000136375ustar00rootroot00000000000000tasks/install/task.bash000066400000000000000000000047211521133302000154440ustar00rootroot00000000000000#!/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.check000066400000000000000000000225401521133302000156030ustar00rootroot00000000000000between: { Updating \s system \s packages } { \=\=\= \s end \s \=\=\= } ~regexp: Dependencies \s resolved generator: <+ .+ \s+ \d+ \s+ \d+ \s+ \d+ \s+ \d+ \s+ \S+ generator: <+ .+ \s+ \d+ \s+ \d+ \s+ \d+ \s+ \d+ \s+ \S+ generator: < \d+ \. \d+ generator: < \d+ \. \d+ \s ppm 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") print(f"assert: {str(state.get('chrony_synced_source_detailed', False)).lower()} Chrony has synchronized source") print(f"assert: {str(state.get('chrony_candidate_sources', False)).lower()} Chrony has candidate 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