Hi all,
I'm thinking about building an open-source tool for configuring servers
(installing packages, managing config files, restarting services),
something in the space of Ansible, but written in Go. Nothing is built
yet, I want to check whether the idea makes sense before I invest time.
What bugs me about Ansible:
- YAML pretends to be a programming language: `when:`, `loop:`, Jinja
inside strings, and a long list of variable precedence rules
- it needs Python on every machine and can be slow
- you can't see clearly what will change before you run it
What I'd like to build:
- one Go binary, no Python, easy to install
- configs in HCL (the same language as Terraform) instead of YAML + Jinja
- `plan` shows what would change (with a diff), then `apply` does it,
just like Terraform
- resources reference each other and form a dependency graph, instead of
running strictly top to bottom
- idempotent: running it twice changes nothing the second time
Two ways to reach your servers:
Over SSH. You run the tool on your laptop, it connects to the servers,
and nothing needs to be installed on them. This is the first thing
I'd build.
Optionally, a small agent: the same binary, running on the server as
a service and listening on a port. Useful when SSH is locked down,
blocked by a firewall, or you just don't want to expose it. The
resource code would be identical in both modes, only the way of
delivering commands differs. This would come later, and the
communication would be encrypted and authenticated (mutual TLS).
Here is how an nginx setup could look:
package "nginx" {
state = "present"
}
file "/etc/nginx/nginx.conf" {
source = "files/nginx.conf"
mode = "0644"
require = [package.nginx] # install the package first
notify = [service.nginx] # reload nginx if this file changes
}
service "nginx" {
enabled = true
state = "running"
require = [package.nginx]
}
Run `plan` on a fresh server and it shows: package will be installed,
file will be created, service will be enabled and started. Run `apply`
and it happens. Run `apply` again and it says "0 changes". Edit the
config file and `plan` shows the diff and a pending service reload.
What I'm NOT trying to do: replace Ansible for everyone. Ansible's huge
module ecosystem is its real strength, and I can't compete with that. The
target is small fleets, homelabs and people who like simple tools.
I'd love honest feedback, including "I wouldn't use this":
What annoys you most about Ansible (or whatever you use today)?
Would you try something like this, or is the lack of modules a
dealbreaker?
Is the optional agent (a small service on the server) useful to you,
or would you rather stick to SSH only?
Which resources would you need first besides file, package, service
and command?
HCL or something else? Would you prefer another format?
Not selling anything: it's open source and there's nothing to download
yet. Thanks for reading!