Skip to main content

Ansible Inventory implementation that uses Python syntax

Project description

Build Status


Ansible Inventory implementation that uses Python syntax


pip3 install pyventory


  • Modular inventory.
  • Assests inheritance using Python classes.
  • Support for multiple inheritance.
  • Support for mixins.
  • Support for vars templating using Python string formatting.
  • Python 3 (>=3.6) support.
  • Python 2 is not supported.


Create and make it executable.

A short example of the contents:

#!/usr/bin/env python3
from pyventory import Asset, ansible_inventory

class All(Asset):
    run_tests = False
    use_redis = False
    redis_host = 'localhost'
    minify = False
    version = 'develop'

class Staging(All):
    run_tests = True

staging = Staging()


Consider a more complex example which passes the following json output to Ansible.

Run Ansible playbook with the -i key:

ansible-playbook -i site.yml

Notice that you need to have your inventory package in PYTHONPATH.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyventory, version 3.2.0
Filename, size File type Python version Upload date Hashes
Filename, size pyventory-3.2.0.tar.gz (5.9 kB) File type Source Python version None Upload date Hashes View
Filename, size pyventory-3.2.0-py3-none-any.whl (6.7 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page