pax_global_header00006660000000000000000000000064152110153170014506gustar00rootroot0000000000000052 comment=0f5c9e94641495e1c54e0a88d5e76cbdbc32a210 README.md000066400000000000000000000001541521101531700123310ustar00rootroot00000000000000# Sparky_Chronie Sparky test for chrony - https://docs.rockylinux.org/guides/automation/configuring_chrony/main.raku000066400000000000000000000000311521101531700126540ustar00rootroot00000000000000task-run "tasks/install";tasks/000077500000000000000000000000001521101531700121775ustar00rootroot00000000000000tasks/install/000077500000000000000000000000001521101531700136455ustar00rootroot00000000000000tasks/install/task.bash000066400000000000000000000043651521101531700154560ustar00rootroot00000000000000#!/bin/bash set -e echo "Starting chrony installation on Rocky Linux..." # Update system echo "Updating system packages..." sudo dnf update -y # Install chrony echo "Installing chrony..." sudo dnf install -y chrony # Start and enable chronyd service echo "Starting chronyd service..." sudo systemctl start chronyd sudo systemctl enable chronyd # Check chronyd service status echo "Checking chronyd service status..." sudo systemctl status chronyd --no-pager # Configure chrony 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 # Display the configuration for verification echo "Verifying chrony configuration..." cat /etc/chrony.conf # Restart chronyd to apply configuration echo "Restarting chronyd service..." sudo systemctl restart chronyd # Check chrony sources echo "Checking chrony sources..." sudo chronyc sources -v # Check chrony tracking echo "Checking chrony tracking..." sudo chronyc tracking # Check chrony activity echo "Checking chrony activity..." sudo chronyc activity # Verify time synchronization echo "Verifying time synchronization..." timedatectl status # Check if chrony is synchronized echo "Checking synchronization status..." sudo chronyc waitsync 10 echo "Chrony installation and configuration completed successfully!"tasks/install/task.check000066400000000000000000000257541521101531700156230ustar00rootroot00000000000000~regexp: Rocky \s Linux \s \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_enabled', False)).lower()} Chronyd service enabled at boot") 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('ntp_servers_configured', 0) >= 4).lower()} At least 4 NTP servers configured (found {state.get('ntp_servers_configured', 0)})") print(f"assert: {str(state.get('driftfile_configured', False)).lower()} Driftfile configured") print(f"assert: {str(state.get('makestep_configured', False)).lower()} Makestep configured") print(f"assert: {str(state.get('rtcsync_enabled', False)).lower()} RTC sync enabled") print(f"assert: {str(state.get('logdir_configured', False)).lower()} Log directory configured") 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") 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