frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: Enroll, a tool to reverse-engineer servers into Ansible config mgmt

https://enroll.sh
85•_mig5•1d ago
Happy new year folks!

This tool was born out of a situation where I had 'inherited' a bunch of servers that were not under any form of config management. Oh, the horror...

Enroll 'harvests' system information such as what packages are installed, what services are running, what files have 'differed' from their out-of-the-box defaults, and what other custom snowflake data might exist.

The harvest state data can be kept as its own sort of SBOM, but also can be converted in a mere second or two into fully-functional Ansible roles/playbooks/inventory.

It can be run remotely over SSH or locally on the machine. Debian and Redhat-like systems are supported.

There is also a 'diff' mode to detect drift over time. (Years ago I used Puppet instead of Ansible and miss the agent/server model where it would check in and re-align to the expected state, in case people were being silly and side-stepping the config management altogether). For now, diff mode doesn't 'enforce' but is just capable of notification (webhook, email, stdout) if changes occur.

Since making the tool, I've found that it's even useful for systems where you already have in Ansible, in that it can detect stuff you forgot to put into Ansible in the first place. I'm now starting to use it as a 'DR strategy' of sorts: still favoring my normal Ansible roles day-to-day (they are more bespoke and easier to read), but running enroll with '--dangerous --sops' in the background periodically as a 'dragnet' catch-all, just in case I ever need it.

Bonus: it also can use my other tool JinjaTurtle, which converts native config files into Jinja2 templates / Ansible vars. That one too was born out of frustration, converting a massive TOML file into Ansible :)

Anyway, hope it's useful to someone other than me! The website has some demos and more documentation. Have fun every(any)-one.

Comments

Imustaskforhelp•3h ago
Bravo, I will play with it. I haven't played with ansible till now but I know that its related to automation.

If something can make ansible easier for me to try out like this tool while being pragmatic, I will give this a try someday thank you!

How accurate does this tool end up becoming though? Like can I just run some bunch of commands to setup a server and then use this with ansible?

Would this end up being a good use for it or would I just re-invent something similar to cloud-init on wrong abstraction. (On all fairness, one thing troubling me about cloud-init is that I would need to probably have a list of all commands that I want to run and all changes which sometimes if history command might have some issues or you do end up writing files etc. ends up being a little messy)

I haven't played that much with both cloud-init and ansible either but I am super interested to know more about enroll and others as well as I found it really cool!

_mig5•1h ago
Great questions! OP here, let me answer them below:

> How accurate does this tool end up becoming though? Like can I just run some bunch of commands to setup a server and then use this with ansible?

Yes, exactly: let's say you provision a VPS and then install some stuff on it, configure some configs, create a crontab, create a user account. Running 'enroll harvest' on it will detect all of that, and 'enroll manifest' will then convert that 'harvest' into Ansible roles/playbooks.

> Would this end up being a good use for it or would I just re-invent something similar to cloud-init on wrong abstraction. (On all fairness, one thing troubling me about cloud-init is that I would need to probably have a list of all commands that I want to run and all changes which sometimes if history command might have some issues or you do end up writing files etc. ends up being a little messy)

Yeah, your instinct is right on the latter point. Ansible and Cloud-init are similar in that they are both 'declarative' systems to say what should exist on the machine. Ansible has some advantages in that it compares with the current setup to see if it needs to change anything. Cloud-init (in my experience) is a bit more crude: 'just run this stuff the first time the machine is booted'.

I'm sure there are different ways of using it, but in my experience, cloud-init is really designed to 'run once' (first time setup). For example, if you provision a machine with Terraform or OpenTofu, and you pass in cloud-init, then later if you change the cloud-init data, it wants to destroy the machine and rebuild it (unless you configure it explicitly not to do that, by which you have to tell it to 'ignore' changes to the cloud-init).

Whereas with Ansible, you're at least equipped with a solid foundation that you can extend over time - you'll no doubt eventually need to make changes to your server post the initial setup.

If you're new to Ansible, Enroll will be a quick way to get up and running with working Ansible configuration and you can adapt it from there as you learn it.

Admittedly, to satisfy a lot of corner cases (or support different Linux distros), the Ansible code that Enroll generates is a bit complex to read compared to a 'bespoke' home-grown playbook, on the other hand, it's perfectly correct code and you'd be immediately exposed to good practice syntax.

Let me know if you get to try it!

nightshift1•3h ago
This makes me think of the now defunct https://github.com/SUSE/machinery
_mig5•1h ago
Indeed! I'm showing my age, but I do remember using this with Puppet and it was one of my inspirations :D (no commits in nearly 13 years, ouch) https://github.com/devstructure/blueprint
heliostatic•1h ago
Yes! I always thought that was a very clever project, and was sad when it ceased development. Very excited to try this out, and glad to have stayed on Debian all these years.
smoyer•3h ago
I have quite a few machines that were constructed using Ansible ... When I get a chance, I'll reverse then and compare the results to the IaC that created them
proxysna•2h ago
Genuenly the thing i've been dreaming about for a while. Nice work.
bcye•2h ago
This looks like a great way to learn Ansible too. Instead of learning alongside random examples, you can setup your server and see how it would look like in Ansible.

Awesome stuff!

barbazoo•2h ago
This is a fantastic idea. I can imagine using this to pull in any manual changes I might have made to the server because I’m not the most disciplined person.
_mig5•1h ago
Haha, same! I ran it on a server I've been shepherding along since 2008 and wow, it was insightful, there were even cron jobs it found that I had forgotten about :)

If you are using a Debian-like or Fedora-like workstation, it's also really useful to 'ansibilize' your desktop OS in case you need to reinstall :)

yowlingcat•1h ago
Very cool! Managing ones boxes as cattle and not pets almost always seems like a better idea in retrospect but historically it is easier said than done. Moreover, I like the idea of being able to diff a box's actual state from a current Ansible system to verify that it actually is as configured for further parity between deployed/planned.
_mig5•1h ago
Definitely! It's all too easy to make a direct change and later forget to 'fold it in' to Ansible and run a playbook. My hope is that `enroll diff` serves as a good reminder if nothing else.

I'm pondering adding some sort of `--enforce` argument to make it re-apply a 'golden' harvest state if you really want to be strictly against drift. For now, it's notifications only though.

_mig5•1h ago
Here's a video of JinjaTurtle, the companion tool that converts configs to Jinja2 templates and Ansible vars:

https://asciinema.org/a/765293

Enroll will automatically make use of jinjaturtle if it's on the $PATH, to generate templates.

novoreorx•59m ago
I wonder if Nix has similar tools, as it is famous for declarative system management, which is quite suitable for server provisioning.
tecoholic•44m ago
Very cool idea and kudos for building and making the idea into a reality.
Quarrel•32m ago
Very cool.

I just saved the state of my WSL2 instance, pushed it to github. Amazingly simple.

FWIW, I was required to add the --harvest, which your quick start seems to be missing?

ie I used:

uvx enroll single-shot --harvest ./harvest --out ./ansible

_mig5•26m ago
Whoops, thanks, I'll adjust that example!

Indeed when using single-shot, unless you're using the --remote modes (in which case, the harvest is pulled down to a machine-generated path locally), indeed you need to supply the path to the harvest so that the 'manifest' part under the hood, knows what to use.

(By contrast, if you are using just the 'enroll harvest' command by itself, and omit the --out option, it will by default store the harvest in a random directory in ~/.cache/enroll/harvest/xxxxxxx)

Thanks for trying it out!

neilv•29m ago
This is a great idea. I have done this manually, and it was a lot of work.

Even with a tool, people will still have to understand the output, enough that they can spot situations like "this part doesn't make sense at all", "that bit isn't static", "holy crud, there's an unsecured secret", "this part suggests a dependency on this other server we didn't know was involved, and which the tool doesn't investigate".

_mig5•24m ago
I agree! It's always a 'best effort' tool. There's going to be corner cases where something that might end up in the 'logrotate' role could arguably be better placed in a more specific app's role.

It does an okay job at this sort of thing, but definitely human eyes are needed :)

xyst•6m ago
poor man’s nixOS

Show HN: Enroll, a tool to reverse-engineer servers into Ansible config mgmt

https://enroll.sh
85•_mig5•1d ago•20 comments

Show HN: OpenWorkers – Self-hosted Cloudflare workers in Rust

https://openworkers.com/introducing-openworkers
382•max_lt•12h ago•115 comments

Show HN: Mini Apps Builder – a no-code way to build Telegram mini apps

https://miniappsbuilder.com/
3•Anton_Ingachev•15m ago•2 comments

Show HN: Feather – a fresh Tcl reimplementation (WASM, Go)

https://www.feather-lang.dev
18•dhamidi•5d ago•3 comments

Show HN: Turning 100-plus comments HN threads into readable discussions

5•freakynit•1h ago•2 comments

Show HN: Wario Synth – Turn any song into Game Boy version

https://www.wario.style
49•birdmania•17h ago•12 comments

Show HN: Tasker – An open-source desktop agent for browser and OS automation

https://automatewithtasker.com/
16•schnetzlerjoe•6h ago•20 comments

Show HN: Stealth and Browsers and Solvers in Rust

https://github.com/ccheshirecat/chaser-oxide
3•ccheshirecat•3h ago•0 comments

Show HN: I created a tool to design and create foamcore inserts for boardgames

https://boxinsertdesigner.com/
47•Rabidgremlin•5d ago•15 comments

Show HN: Use Claude Code to Query 600 GB Indexes over Hacker News, ArXiv, etc.

https://exopriors.com/scry
369•Xyra•1d ago•134 comments

Show HN: Ducklang: Achieving 100x more requests per second than NextJS

https://duck-lang.dev
6•Apfelfrosch•4h ago•2 comments

Show HN: BusterMQ, Thread-per-core NATS server in Zig with io_uring

https://bustermq.sh/
130•jbaptiste•1d ago•65 comments

Show HN: ADSBee, an open source dual band embedded ADS-B receiver for anything

https://pantsforbirds.com/adsbee-1090/
5•CoolNamesAllTkn•4h ago•3 comments

Show HN: An SVG Inspection Tool

https://www.svg.studio/
6•gatkinso•8h ago•0 comments

Show HN: DBPiper – Affordable Sequin alternative ($15 vs. $1000)

https://dbpiper.netlify.app/
2•aliamer99•5h ago•0 comments

Show HN: Tools for Humans – Public Tracker for Workflows

https://turboops.io/platform/public-tracker
3•dm03514•8h ago•0 comments

Show HN: A pet link saver OSS project that keeps growing

https://linkversity.lol/
3•osdotsystem•5h ago•0 comments

Show HN: Feature detection exploration in Lidar DEMs via differential decomp

https://github.com/bshepp/RESIDUALS
6•DarkForestery•1d ago•0 comments

Show HN: VectorDBZ, a desktop GUI for vector databases

https://github.com/vectordbz/vectordbz
7•snirjka•12h ago•0 comments

Show HN: Testing how symbolic framing affects LLMs

2•Daladim•7h ago•1 comments

Show HN: Speak Your Find – Voice-first intent matching with Gemini and pgvector

https://speakyourfind.com/
2•sameg14•7h ago•0 comments

Show HN: 22 GB of Hacker News in SQLite

https://hackerbook.dosaygo.com
713•keepamovin•2d ago•216 comments

Show HN: Latent Signal - Curated feed for AI news

https://latentsignal.fyi
3•humships•9h ago•4 comments

Show HN: A local-first financial auditor using IBM Granite, MCP, and SQLite

https://github.com/simplynd/expense-ai
18•simplynd•1d ago•3 comments

Show HN: Downmark – Turn webpages into distraction-free Markdown

https://downmark.fly.dev/https%3A%2F%2Fgithub.com%2Fadhipk%2Fdownmark
2•AdhipKashyap•11h ago•1 comments

Show HN: C-TURTL, a turtle graphics game

https://michae2.github.io/c-turtl/
2•michae2•11h ago•1 comments

Show HN: DroidDock – Browse Android files on Mac with a Finder-like experience

https://rajivm1991.github.io/DroidDock/releases/v0.2.1.html
4•rajivm1991•11h ago•0 comments

Show HN: Chat with people who share the same Internet connection (= IP address)

https://ipchat.org
15•kkovacs•1d ago•15 comments

Show HN: A weekend project to visualize your HN usage in 2025

https://hn-summary.userjam.com
9•giladvdn•12h ago•1 comments

Show HN: Earth.Org.UK public data snapshot including home energy timeseries

https://zenodo.org/records/18116386
2•DamonHD•12h ago•1 comments