{"id":18555145,"url":"https://github.com/arillso/go.ansible","last_synced_at":"2025-07-19T18:08:57.544Z","repository":{"id":52413558,"uuid":"251373065","full_name":"arillso/go.ansible","owner":"arillso","description":"Go module for running Ansible Commandors on a Linux system.","archived":false,"fork":false,"pushed_at":"2025-06-22T00:07:26.000Z","size":62,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-06-22T01:20:05.698Z","etag":null,"topics":["go","golang","library","module"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arillso.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-03-30T17:04:28.000Z","updated_at":"2025-06-22T00:07:24.000Z","dependencies_parsed_at":"2024-11-06T21:32:16.913Z","dependency_job_id":"f8317cf3-13d0-4a7d-8dc1-44d8581253d1","html_url":"https://github.com/arillso/go.ansible","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/arillso/go.ansible","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arillso%2Fgo.ansible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arillso%2Fgo.ansible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arillso%2Fgo.ansible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arillso%2Fgo.ansible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arillso","download_url":"https://codeload.github.com/arillso/go.ansible/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arillso%2Fgo.ansible/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265982914,"owners_count":23859576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","library","module"],"created_at":"2024-11-06T21:25:23.980Z","updated_at":"2025-07-19T18:08:57.519Z","avatar_url":"https://github.com/arillso.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GO Ansible\n\n\u003c!-- markdownlint-enable --\u003e\n\n[![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=popout-square)](LICENSE)\n[![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/arillso/go.ansible?style=popout-square)](https://pkg.go.dev/github.com/arillso/go.ansible?tab=doc)\n[![GitHub release](https://img.shields.io/github/v/release/arillso/go.ansible?style=popout-square)](https://github.com/arillso/go.ansible/releases)\n[![Go Report Card](https://goreportcard.com/badge/github.com/arillso/go.ansible)](https://goreportcard.com/report/github.com/arillso/go.ansible)\n\n\u003c!-- markdownlint-disable --\u003e\n\n## Overview\n\n**GO Ansible** is a Go module designed to programmatically run Ansible playbooks on Linux systems. It supports:\n\n- **Automated Playbook Resolution:** Resolves file patterns (glob) and validates playbook existence.\n- **Temporary File Management:** Manages temporary files (SSH private keys and Vault passwords) securely.\n- **Galaxy Integration:** Installs roles and collections from Ansible Galaxy with extensive configuration.\n- **Flexible Configuration:** Customizes Ansible commands (inventories, extra vars, SSH/user options, verbosity).\n- **Enhanced Environment Variables:** Sets variables like `ANSIBLE_CONFIG` based on provided configurations.\n- **Debug and Traceability:** Provides detailed command tracing in debug mode for easier troubleshooting.\n\n## Features\n\n### Playbook Execution and Management\n\n- **Playbook Resolution:** Supports file names and glob patterns for playbook identification.\n- **Temporary Files:** Manages SSH keys and Vault passwords, cleaning them up automatically.\n- **Inventory Management:** Supports inline (`localhost,`) and file-based inventories.\n\n### Advanced Options\n\n- **Command Building:** Constructs commands with options (check/diff modes, user settings, forks).\n- **Extra Vars Management:** Passes multiple variables to playbooks with `--extra-vars`.\n- **Verbose Logging:** Offers configurable verbosity (up to `-vvvv`) for detailed logs.\n\n### Galaxy Integration\n\n- **Roles and Collections:** Installs Galaxy roles and collections using a configuration file.\n- **Customization:** API keys, server URLs, certificate ignoring, timeouts, dependencies handling.\n- **Upgrades:** Provides options to upgrade existing Galaxy collections.\n\n### Debugging and Error Handling\n\n- **Command Tracing:** Debug mode prints every executed command for tracing.\n- **Context-Based Execution:** Uses Go’s `context.Context` for command management and cancellation.\n- **Error Reporting:** Wraps errors with contextual information using `github.com/pkg/errors`.\n\n## Installation\n\nEnsure you have [Go (version 1.23 or higher)](https://golang.org/dl/) installed, then run:\n\n```bash\ngo mod download\n```\n\n## Usage\n\nThe module serves as a foundation for executing Ansible playbooks in applications. Example:\n\n1. **Create and Configure a Playbook Instance:**\n\n```go\npackage main\n\nimport (\n  \"context\"\n  \"log\"\n  \"github.com/arillso/go.ansible/ansible\"\n)\n\nfunc main() {\n  pb := ansible.NewPlaybook()\n  pb.Config.Playbooks = []string{\"site.yml\"}\n  pb.Config.Inventories = []string{\"localhost,\"}\n  pb.Config.PrivateKey = \"your ssh private key...\"\n  pb.Config.VaultPassword = \"your vault password...\"\n\n  if err := pb.Exec(context.Background()); err != nil {\n    log.Fatalf(\"Execution failed: %v\", err)\n  }\n}\n```\n\n2. **Command Construction and Execution:**\n\nThe module automatically constructs commands and manages dependencies (like Galaxy installations).\n\n## Testing\n\nThe repository includes tests covering functionalities such as playbook resolution, temporary files, and extra vars:\n\n```bash\ngo test -v ./...\n```\n\n## CI/CD and Linters\n\n- **Continuous Integration:** GitHub Actions automatically run tests on push and pull requests.\n- **Code Quality:** Makefile targets for formatting and linting ensure best practices.\n- **Pre-commit Hooks:** Automatically fix issues like trailing whitespace and line endings.\n\n## License\n\nLicensed under the [MIT License](LICENSE).\n\n## Copyright\n\n(c) 2022, Arillso\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farillso%2Fgo.ansible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farillso%2Fgo.ansible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farillso%2Fgo.ansible/lists"}