pax_global_header00006660000000000000000000000064152110160040014500gustar00rootroot0000000000000052 comment=5e32f060df62ab51c2d1216755445699507851d5 README.md000066400000000000000000000001541521101600400123230ustar00rootroot00000000000000# Sparky_Chronie Sparky test for chrony - https://docs.rockylinux.org/guides/automation/configuring_chrony/main.raku000066400000000000000000000000311521101600400126460ustar00rootroot00000000000000task-run "tasks/install";tasks/000077500000000000000000000000001521101600400121715ustar00rootroot00000000000000tasks/install/000077500000000000000000000000001521101600400136375ustar00rootroot00000000000000tasks/install/task.bash000066400000000000000000000051171521101600400154440ustar00rootroot00000000000000#!/bin/bash set -e echo "Starting chrony installation on Rocky Linux..." echo "========" # Update system echo "Updating system packages..." sudo dnf update -y echo "========" # Install chrony echo "Installing chrony..." sudo dnf install -y chrony echo "========" # Start and enable chronyd service echo "Starting chronyd service..." sudo systemctl start chronyd sudo systemctl enable chronyd echo "========" # Check chronyd service status echo "Checking chronyd service status..." sudo systemctl status chronyd --no-pager echo "========" # 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 echo "========" # Display the configuration for verification echo "Verifying chrony configuration..." cat /etc/chrony.conf echo "========" # Restart chronyd to apply configuration echo "Restarting chronyd service..." sudo systemctl restart chronyd echo "========" # Wait for chrony to stabilize with new configuration echo "Waiting for chrony to stabilize..." sleep 10 echo "========" # Check chrony sources echo "Checking chrony sources..." sudo chronyc sources -v echo "========" # Check chrony tracking echo "Checking chrony tracking..." sudo chronyc tracking echo "========" # Check chrony activity echo "Checking chrony activity..." sudo chronyc activity echo "========" # Verify time synchronization echo "Verifying time synchronization..." timedatectl status echo "========" # Check if chrony is synchronized echo "Checking synchronization status..." sudo chronyc waitsync 10 echo "========" echo "Chrony installation and configuration completed successfully!" echo "========"tasks/install/task.check000066400000000000000000000257541521101600400156150ustar00rootroot00000000000000~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