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.
- Add debug output showing rsyslogd_check.diff structure
- Simplify file extraction logic for rsyslog.d directory changes
- Show full JSON payload before sending to API
- Add connectivity test to gitops-status-server before POST
- Show curl command and response codes for debugging
- Display warning if OUT_OF_SYNC but no files extracted
This helps diagnose why drift is detected but files aren't listed in the JSON.
Root causes:
1. Inconsistent Ansible callback (minimal) broke debug output parsing
2. DRIFTED_FILES extraction failed due to format changes
3. Files array stayed empty even when drift was detected
Fixes:
1. Use YAML callback for consistent, structured output
2. Improve DRIFTED_FILES parsing to handle YAML format
3. Remove conflicting ANSIBLE_CALLBACKS_ENABLED/minimal settings
4. Add GITOPS_STATUS_FIX.md with complete analysis
Result:
- Files array now populates correctly when drift exists
- Sync status accurately reflects actual server state
- Better debug logging for troubleshooting
See GITOPS_STATUS_FIX.md for full root cause analysis and testing guide.
- Capture and display full curl response body for debugging
- Add verification step to confirm JSON was stored on server
- Improve error messages with connectivity troubleshooting hints