Pure Go Ansible playbook engine
- Go 100%
The .core/ root holds tracked Lethean canon config (go.yaml, build.yaml, agents.yaml, etc.). Only the runtime subdirs (workspace/, vm/, cache/, runtime/) and per-repo runtime artifacts should be gitignored. Brings this repo into the managed canonical set per audit-sweep discovery filter. Co-Authored-By: Cladius Maximus <cladius@lethean.io> |
||
|---|---|---|
| .core | ||
| .github/workflows | ||
| docs | ||
| external | ||
| go | ||
| kb | ||
| .gitignore | ||
| .gitmodules | ||
| .woodpecker.yml | ||
| AGENTS.md | ||
| CLAUDE.md | ||
| CONSUMERS.md | ||
| CONVENTION_DRIFT_REPORT.md | ||
| go.work | ||
| LICENCE | ||
| README.md | ||
| sonar-project.properties | ||
go-ansible
dappco.re/go/ansible is a native Go implementation of core Ansible playbook mechanics. It parses playbooks, inventories, roles, variables, loops, handlers, and common built-in modules, then executes them through either SSH clients or a local controller-side client.
The package is designed for Go programs that need Ansible-style orchestration without shelling out to Python Ansible. It keeps the public surface small:
NewParserreads playbooks, inventories, task files, vars files, and role directories.NewExecutorruns parsed playbooks with inventory, host variables, facts, handlers, loops, tags, check mode, and diff reporting.NewSSHClientprovides the remote execution client used by the executor.cmd/ansible.Registerwires the native runner into adappco.re/gocommand tree.
Install
go get dappco.re/go/ansible
Quick Start
executor := ansible.NewExecutor("/srv/playbooks")
if err := executor.SetInventory("/srv/inventory.yml"); err != nil {
return err
}
executor.SetVar("release", "2026.04")
return executor.Run(context.Background(), "/srv/playbooks/site.yml")
For command integration:
app := core.New()
ansiblecmd.Register(app)
Development
This repository follows the dappco.re/go v0.9 shape: core wrappers are used instead of direct imports for banned standard-library surfaces, public symbols have file-aware Good/Bad/Ugly test triplets, and examples live beside their source file. Run the full gate before handing changes off:
GOWORK=off go mod tidy
GOWORK=off go vet ./...
GOWORK=off go test -count=1 ./...
gofmt -l .
bash /Users/snider/Code/core/go/tests/cli/v090-upgrade/audit.sh .