CRITICAL FIX FOR WINDOWS:
Problem: Git on Windows uses CRLF, but deployed files use LF. When comparing
with slurp (byte-for-byte base64 comparison), CRLF != LF causes false positives.
Solution: Decode base64 content and normalize line endings:
- Replace CRLF with LF in both Git and server file content
- Then compare the normalized content
This ensures that line ending differences don't trigger false OUT_OF_SYNC alerts.
After deploy, content will match regardless of platform line ending differences.
CRITICAL FIX:
Problem: Previous version used multiple stat operations and loops which created
too many file descriptors and fsnotify watchers, causing 'too many open files' errors.
Solution: Use only:
- slurp: Direct file content reading (no watchers)
- find: Single operation to list directory files (no loops)
New logic is clean and simple:
1. Read Git rsyslog.conf + server rsyslog.conf (slurp)
2. Compare content directly (byte comparison)
3. List Git rsyslog.d files + server rsyslog.d files (find)
4. Compare file names (no permission checks, no loops)
5. Output DRIFTED_FILES and SYNC_STATUS markers
This eliminates file descriptor exhaustion while maintaining correct drift detection.
After deploy, when content matches, playbook exits 0 (SYNCED).
CRITICAL FIX:
Problem: drift-check.yml was using 'copy' module in check_mode, which compares:
- File content ✓
- Permissions (owner, group, mode) ✗
- Ownership ✗
After deploy, files have root:root 0644 permissions. Even though content matches,
the copy module marked files as 'changed' because permissions were being compared.
This caused false OUT_OF_SYNC reports even when configuration was actually synced.
Solution: Use MD5 checksum-based comparison instead:
- Compare only file CONTENT using stat checksums
- Ignore permissions/ownership differences
- This is what matters for config management
Also fixed URLs:
- Changed back from port 80 to port 5000 (API only)
- Updated service name to gitops-status-api
Now drift detection only triggers on actual config changes, not permission differences.
After successful deploy, should correctly report SYNCED status.