{"id":14985650,"url":"https://github.com/leboncoin/simple-ansible-inventory","last_synced_at":"2026-03-10T10:32:07.104Z","repository":{"id":88452138,"uuid":"143015942","full_name":"leboncoin/simple-ansible-inventory","owner":"leboncoin","description":"A simple, clean and easily readable Ansible inventory","archived":false,"fork":false,"pushed_at":"2025-01-19T00:18:57.000Z","size":10,"stargazers_count":30,"open_issues_count":0,"forks_count":11,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-11T22:05:12.650Z","etag":null,"topics":["ansible","ansible-inventory","inventory","leboncoin","yaml","yml"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/leboncoin.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2018-07-31T13:11:53.000Z","updated_at":"2025-03-04T07:22:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"9df1b909-0412-4694-b2da-6a8bc9beaeb5","html_url":"https://github.com/leboncoin/simple-ansible-inventory","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"14badff930cf0915591e391acb459f89728361ce"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leboncoin/simple-ansible-inventory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leboncoin%2Fsimple-ansible-inventory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leboncoin%2Fsimple-ansible-inventory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leboncoin%2Fsimple-ansible-inventory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leboncoin%2Fsimple-ansible-inventory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leboncoin","download_url":"https://codeload.github.com/leboncoin/simple-ansible-inventory/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leboncoin%2Fsimple-ansible-inventory/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30330575,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T05:25:20.737Z","status":"ssl_error","status_checked_at":"2026-03-10T05:25:17.430Z","response_time":106,"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":["ansible","ansible-inventory","inventory","leboncoin","yaml","yml"],"created_at":"2024-09-24T14:11:25.836Z","updated_at":"2026-03-10T10:32:07.084Z","avatar_url":"https://github.com/leboncoin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Ansible Inventory\n\nThe idea is to keep an Ansible inventory simple, clean and easily readable.\nEach host will only have to be written one time and you'll not have to define each group before using it.\n\n## Prerequisites\n\nSimple Ansible Inventory works with python2 and python3.\nOnly the package [`pyyaml`](https://pypi.org/project/PyYAML/) is needed. You can install it using one of the following commands\n\n`pip install -r requirements.txt`\n\nor\n\n`pip install pyyaml`\n\n## How to use\n\n### Alone\n\n`./simple-ansible-inventory.py --list`\n\n### With ansible\n\n`ansible-inventory -i simple-ansible-inventory.py --list`\n\nTo work properly, `simple-ansible-inventory.py` needs inventory file(s) to read.\nThere's two possibilities :\n * By default, `simple-ansible-inventory.py` will look in its folder and in all of its subfolder for inventory yaml file(s)\n * If the environment variable `ANSIBLE_YAML_INVENTORY` is defined, `simple-ansible-inventory.py` will attempt to read the inventory file in the environment variable and only this one\n\n## Directory layout\n\nThe directory layout followed is given by the Ansible best pratices.\nhttps://docs.ansible.com/ansible/latest/user_guide/playbooks_best_practices.html#directory-layout\n\n## Inventory files\n\nYou can find inventory file examples in [`inventory_file_1.yml`](inventory_file_1.yml) and [`inventory_file_2.yml`](inventory_file_2.yml)\n\nAn inventory file is a yaml file starting with the following header\n```yaml\n---\n#### YAML inventory file\n```\n\nIn this inventory file, you only define hosts and groups associated to this host.\nThere's no group definition, a group is automatically created when associated to an host.\n\nExample:\n\nIf you define the following host\n```yaml\nhosts:\n  - host: luke-01.example.com\n    groups: [group_1, datacenter_1]\n```\n\n- the host `luke-01.example.com` will be created\n- groups `group_1` and `datacenter_1` will be created\n- groups `group_1` and `datacenter_1` will be associated to the host `luke-01.example.com`\n\n## Group vars\n\nFollowing Ansible best practices, all group vars have to be defined in the `group_vars` folder.\nIf you want to create the variable `group: Rebels` for the group `group_1`, you have to create the file [`group_vars/group_1.yml`](group_vars/group_1.yml) with the following content:\n\n```yaml\n---\ngroup: Rebels\n```\n\n## Host vars\n\nThere's two possibilities to define host vars\n\n1. In the inventory file\n2. In the `host_vars` folder (following Ansible best practices)\n\n\n### In the inventory file\n\nIf you want to create the variable `lightsaber: blue` for the host `obi-wan-02.example.com`, you have to set `hostvars` for the host in the inventory file:\n\n```yaml\n- host: obi-wan-02.example.com\n  hostvars:\n    lightsaber: blue\n  groups: [group_1, datacenter_1]\n```\n\n### In the `host_vars` folder (following Ansible best practices)\n\nFollowing Ansible best practices, host vars have to be defined in the `host_vars` folder.\nIf you want to create the variable `force_side: Sith` for the host `darth-vader-01.example.com`, you have to create the file [`host_vars/darth-vader-01.example.com.yml`](host_vars/darth-vader-01.example.com.yml) with the following content:\n\n```yaml\n---\nforce_side: Sith\n```\n\n\n## And that's it !","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleboncoin%2Fsimple-ansible-inventory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleboncoin%2Fsimple-ansible-inventory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleboncoin%2Fsimple-ansible-inventory/lists"}