A Go module for programmatically executing Ansible playbooks with support for Galaxy integration, temporary file management, and flexible configuration.
Documentation: https://pkg.go.dev/github.com/arillso/go.ansible
Install the module:
go get github.com/arillso/go.ansibleBasic usage:
package main
import (
"context"
"log"
"github.com/arillso/go.ansible"
)
func main() {
pb := ansible.NewPlaybook()
pb.Config.Playbooks = []string{"site.yml"}
pb.Config.Inventories = []string{"localhost,"}
if err := pb.Exec(context.Background()); err != nil {
log.Fatalf("Execution failed: %v", err)
}
}- Automated playbook resolution with glob pattern support
- Secure temporary file management for SSH keys and Vault passwords
- Ansible Galaxy role and collection installation
- Flexible command customization (inventories, extra vars, SSH options)
- Debug mode with command tracing
- Context-based execution with cancellation support
Run tests:
go test -v ./...MIT License
(c) 2026, Arillso