Initial commit

This commit is contained in:
Miguel Jacq 2025-12-14 20:53:22 +11:00
commit 5398ad123c
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
14 changed files with 2147 additions and 0 deletions

59
README.md Normal file
View file

@ -0,0 +1,59 @@
# Enroll
**enroll** inspects a Linux machine (currently Debian-only) and generates Ansible roles for things it finds running on the machine.
It aims to be **optimistic and noninteractive**:
- Detects packages that have been installed
- Detects Debian package ownership of `/etc` files using dpkgs local database.
- Captures config that has **changed from packaged defaults** (dpkg conffile hashes + package md5sums when available).
- Also captures **service-relevant custom/unowned files** under `/etc/<service>/...` (e.g. drop-in config includes).
- Defensively excludes likely secrets (path denylist + content sniff + size caps).
- Captures non-system users that exist on the system, and their SSH public keys
## Install (Poetry)
```bash
poetry install
poetry run enroll --help
```
## Usage
On the host (root recommended):
### 1. Generate a bundle of state/information about the host
```bash
sudo poetry run enroll harvest --out /tmp/enroll-bundle
```
### 2. Generate Ansible manifests (roles/playbook) from that bundle
```bash
sudo poetry run enroll manifest --bundle /tmp/enroll-bundle --out /tmp/enroll-ansible
```
### Alternatively, do both steps in one shot:
```bash
sudo poetry run enroll export --bundle /tmp/enroll-bundle --out /tmp/enroll-ansible
```
Then run:
```bash
ansible-playbook -i "localhost," -c local /tmp/enroll-ansible/playbook.yml
```
## Notes / Safety
- enroll **skips** common sensitive locations like `/etc/ssl/private/*`, `/etc/ssh/ssh_host_*`, and files that look like private keys/tokens.
- It also skips symlinks, binary-ish files, and large files by default.
- Review each generated roles README before committing it anywhere.
- It only stores the raw config files. If you want to turn these into Jinja2 templates with dynamic inventory, see my other tool https://git.mig5.net/mig5/jinjaturtle .
## Troubleshooting
- Run as root for the most complete harvest (`sudo ...`).