{"id":42126275,"url":"https://github.com/hyperifyio/goinventor","last_synced_at":"2026-01-26T15:09:04.956Z","repository":{"id":220422686,"uuid":"751581964","full_name":"hyperifyio/goinventor","owner":"hyperifyio","description":"Ansible compatible key-value inventory adaptor","archived":false,"fork":false,"pushed_at":"2024-03-23T08:27:14.000Z","size":19,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-21T08:12:16.706Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyperifyio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2024-02-01T22:20:38.000Z","updated_at":"2024-02-02T00:13:15.000Z","dependencies_parsed_at":"2024-06-21T07:08:15.178Z","dependency_job_id":"ea82c90f-d0da-419f-bcb6-8bf2cc6acdf4","html_url":"https://github.com/hyperifyio/goinventor","commit_stats":null,"previous_names":["hyperifyio/goinventor"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/hyperifyio/goinventor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperifyio%2Fgoinventor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperifyio%2Fgoinventor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperifyio%2Fgoinventor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperifyio%2Fgoinventor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperifyio","download_url":"https://codeload.github.com/hyperifyio/goinventor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperifyio%2Fgoinventor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28781308,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T13:55:28.044Z","status":"ssl_error","status_checked_at":"2026-01-26T13:55:26.068Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-01-26T15:09:04.891Z","updated_at":"2026-01-26T15:09:04.944Z","avatar_url":"https://github.com/hyperifyio.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hyperifyio/goinventor\n\n`goinventor` is a versatile command line tool that bridges various key-value\nstores with Ansible's dynamic inventory system. It's crafted to simplify and \nenhance the management of Ansible inventories, leveraging the power of different\ndata sources.\n\n![main branch status](https://github.com/hyperifyio/goinventor/actions/workflows/build.yml/badge.svg?branch=main)\n![dev branch status](https://github.com/hyperifyio/goinventor/actions/workflows/build.yml/badge.svg?branch=dev)\n\n## Quick Start Guide\n\nTo get started with `goinventor`, download the latest release for your operating\nsystem and execute it with the necessary flags:\n\n```bash\nwget https://github.com/hyperifyio/goinventor/releases/download/v0.0.1/goinventor-v0.0.1-linux-amd64.zip\nunzip ./goinventor-v0.0.1-linux-amd64.zip\ncd goinventor-v0.0.1-linux-amd64\n./goinventor\n```\n\nFor global installation:\n\n```\nsudo cp ./goinventor /usr/local/bin/goinventor\n```\n\n## Setting Up for Development\n\nTo build `goinventor` from source:\n\n```bash\ngit clone git@github.com:hyperifyio/goinventor.git\ncd goinventor\nmake\n./goinventor\n```\n\n## License\n\nCopyright (c) Heusala Group Ltd. All rights reserved.\n\n`goinventor` initially operates under the HG Evaluation and Non-Commercial License for two years, post which \nit transitions to the MIT license for broader usage, including commercial purposes. Refer to \n[LICENSE.md](LICENSE.md) for details.\n\n**Commercial licenses can be obtained under separate agreements.**\n\n## Usage and Configuration\n\nFor usage and configuration options:\n\n```bash\n./goinventor --help\n```\n\nOutput:\n\n```\nUsage of ./goinventor:\n  -env-prefix string\n        Prefix for ENV variables (default \"INVENTORY_\")\n  -host string\n        Get host specific values\n  -list\n        List all hosts\n  -nats string\n        The NATS server URL (default \"nats://127.0.0.1:4222\")\n  -source string\n        The key value store source (env/nats) (default \"env\")\n```\n\n## Integrating with Ansible\n\nTest with Ansible and env based inventory:\n\n```\nINVENTORY_hosts_host1_hostname=host1 ansible-inventory -i goinventor --list\n```\n\nJSON Output:\n\n```json\n{\n  \"_meta\": {\n    \"hostvars\": {\n      \"host1\": {\n        \"hostname\": \"host1\"\n      }\n    }\n  },\n  \"all\": {\n    \"children\": [\n      \"ungrouped\",\n      \"hosts\"\n    ]\n  },\n  \"hosts\": {\n    \"hosts\": [\n      \"host1\"\n    ]\n  }\n}\n```\n\nYAML Output:\n\n```\nINVENTORY_hosts_host1_hostname=host1 ansible-inventory -i goinventor --list --yaml\n```\n\n```yaml\nall:\n  children:\n    hosts:\n      hosts:\n        host1:\n          hostname: host1\n```\n\n### Retrieving Single Host Variables\n\nCommand:\n\n```\nINVENTORY_hosts_host1_hostname=host1 ansible-inventory -i goinventor --host host1\n```\n\nResult:\n\n```json\n{\n  \"hostname\": \"host1\"\n}\n```\n\n## Inventory Naming Convention\n\nThe `goinventor` tool employs a specific naming convention for environment \nvariables to efficiently manage and categorize inventory data for Ansible. This \nconvention facilitates the dynamic allocation of variables to the appropriate \ngroups and hosts within the inventory.\n\n### Format\n\nThe environment variables follow these patterns:\n\n1. **Host-Specific Variables**:  \n   Format: `PREFIX_group_hostname_key=value`  \n   Description: Sets a variable (`key=value`) for a specific host (`hostname`) \n   within a named group (`group`).  \n   Example: `INVENTORY_webservers_web1_ansible_host=192.168.1.10`\n\n2. **Host Variables Without Group**:  \n   Format: `PREFIX__hostname_key=value`  \n   Equivalent to: `PREFIX_ungrouped_hostname_key=value`  \n   Description: Assigns a variable to a host not explicitly assigned to any\n   other group.  \n   Example: `INVENTORY__web1_ansible_host=192.168.1.10`\n\n3. **Group-Specific Variables**:  \n   Format: `PREFIX_group__key=value`  \n   Description: Sets a variable for all hosts within a specified group.  \n   Example: `INVENTORY_webservers__ansible_user=admin`\n\n4. **Global Variables**:\n   Format: `PREFIX___key=value`  \n   Equivalent to: `PREFIX_all__key=value`  \n   Description: Defines global variables applicable to all groups and hosts.  \n   Example: `INVENTORY___ansible_connection=ssh`\n\n### Usage in Ansible\n\nThese environment variables are parsed by `goinventor` to construct a dynamic\ninventory for Ansible. The tool categorizes and structures the data according to\nthe established naming conventions, ensuring that each variable is accurately\nassigned in the Ansible inventory.\n\nBy adhering to these conventions, users can dynamically manage complex \ninventories with ease, providing a flexible and powerful approach to configuring\nAnsible playbooks and roles.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperifyio%2Fgoinventor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperifyio%2Fgoinventor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperifyio%2Fgoinventor/lists"}