audit: read-only droplet-drift checker (issue #38)#40
Merged
Conversation
Compares md5 of every file the ansible roles install against the live droplet over a single ssh round-trip. TEMPLATE rows (those rendered from .j2 with inventory vars) are reported with stat info but not auto-diffed. Run after any PR that touches deploy/ansible/ to surface what needs to be pushed manually until we resolve the broader ansible ownership question (issue #38).
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stopgap tool for issue #38: a read-only script that compares every file the ansible roles claim to manage against what's actually on shithub-prod, in a single ssh round-trip. Reports OK / DRIFT / MISSING / TEMPLATE per path.
`copy:` files (no templating) are diffed by md5. `template:` files are listed with stat info — comparing rendered output requires inventory vars we don't have locally.
What it caught (and we already fixed in this pass)
Three drifted files. PR #21's path fix and PR #15's aide exclusions had landed in the repo but never reached the droplet:
All five files now match between repo and droplet.
How to use
```sh
deploy/audit/check-droplet-drift.sh
Exit 0: no drift on copy: files
Exit 1: drift detected (eyeball template rows manually)
Exit 2: ssh failure
```
Followup
This script is a stopgap; it does not solve issue #38. The decision between "make ansible authoritative" vs "drop ansible" is still pending.
After every PR that touches `deploy/ansible/`, run this and fix any drift before closing the loop. Eventually a `make audit` target or CI check should run it, but that requires CI to have an ssh key to prod which is its own decision.