{"id":15151626,"url":"https://github.com/lig/pyventory","last_synced_at":"2025-10-24T07:31:16.357Z","repository":{"id":57458337,"uuid":"74763934","full_name":"lig/pyventory","owner":"lig","description":"Ansible Inventory implementation that uses Python syntax","archived":false,"fork":false,"pushed_at":"2022-12-09T08:33:07.000Z","size":135,"stargazers_count":24,"open_issues_count":5,"forks_count":3,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-02-05T12:08:02.530Z","etag":null,"topics":["ansible","inventory","python","python3","terraform"],"latest_commit_sha":null,"homepage":"https://pyventory.readthedocs.io","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/lig.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-25T14:14:16.000Z","updated_at":"2023-08-23T12:58:15.000Z","dependencies_parsed_at":"2023-01-25T12:30:27.885Z","dependency_job_id":null,"html_url":"https://github.com/lig/pyventory","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lig%2Fpyventory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lig%2Fpyventory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lig%2Fpyventory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lig%2Fpyventory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lig","download_url":"https://codeload.github.com/lig/pyventory/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237932070,"owners_count":19389560,"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":["ansible","inventory","python","python3","terraform"],"created_at":"2024-09-26T15:04:35.921Z","updated_at":"2025-10-24T07:31:11.019Z","avatar_url":"https://github.com/lig.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CI Status](https://github.com/lig/pyventory/workflows/CI/badge.svg)](https://github.com/lig/pyventory/actions)\n\n# Pyventory\n\nAnsible Inventory implementation that uses Python syntax\n\n## Install\n\n```shell\npip3 install pyventory\n```\n\n## Features\n\n* Modular inventory.\n* Assests inheritance using Python classes.\n* Support for multiple inheritance.\n* Support for mixins.\n* Support for vars templating using [Python string formatting](https://docs.python.org/3/library/string.html#format-specification-mini-language).\n* Python 3 (\u003e=3.6) support.\n* Python 2 is not supported.\n\n## Usage\n\nCreate `hosts.py` and make it executable.\n\nA short example of the `hosts.py` contents:\n\n```python\n#!/usr/bin/env python3\nfrom pyventory import Asset, ansible_inventory\n\nclass All(Asset):\n    run_tests = False\n    use_redis = False\n    redis_host = 'localhost'\n    minify = False\n    version = 'develop'\n\nclass Staging(All):\n    run_tests = True\n\nstaging = Staging()\n\nansible_inventory(locals())\n```\n\nConsider a [more complex example](tests/example) which passes the following [json output](tests/example.json) to Ansible.\n\nRun Ansible playbook with the `-i hosts.py` key:\n\n```shell\nansible-playbook -i hosts.py site.yml\n```\n\nNotice that you need to have your inventory package in `PYTHONPATH`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flig%2Fpyventory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flig%2Fpyventory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flig%2Fpyventory/lists"}