Skip to main content

Pinventory

Pinventory is an Ansible Dynamic Inventory for locating and categorising Raspberry Pi computers on the local network.

Installation

In the Python environment which you are using:

$ python setup.py install

A wrapper script called simply pinventory will be installed which can be used to invoke the Python package.

Direct usage

To obtain an Ansible inventory of Raspberry Pi computers on the LAN:

$ pinventory --list --pretty
{
    "_meta": {
        "hostvars": {
            "10.0.0.149": {
                "hostname": "lime",
                "ip": "10.0.0.149",
                "mac": "b8:27:eb:a5:93:c5"
            },
            "10.0.0.186": {
                "hostname": "raspberrypi",
                "ip": "10.0.0.186",
                "mac": "b8:27:eb:73:9d:67"
            }
        }
    },
    "raspberries": {
        "hosts": [
            "10.0.0.149",
            "10.0.0.186"
        ]
    }
}

To obtain the host variables for a particular host:

$ pinventory --host 10.0.0.149 --pretty
{
    "hostname": "lime",
    "ip": "10.0.0.149",
    "mac": "b8:27:eb:a5:93:c5"
}

Invocation from Ansible

Pass the pinventory executable using the -i inventory option, and Ansible will execute it as a dynamic inventory. For example, assuming pinventory is available on the PATH, to run an ad hoc Ansible command on all Raspberry Pi devices on the LAN, use:

$ ansible raspberries -i `which pinventory` <command>

Customisation

By default the returned inventory includes all Raspberry Pi computers on the local network. The contents of the inventory and variables associated with each host can be customised by providing pluggable functions at two pkg_resources entry points capable of transforming the default inventory and host variables respectively. Example functions can be found in the pinventory.transforms.hostsvars and pinventory.transforms.inventory sub-modules.

Metadata

Release files for pinventory 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pinventory 0.5.0
File Size Uploaded
pinventory-0.5.0.tar.gz 6.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pinventory 0.5.0
File Interpreter ABI Platform
pinventory-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.9 kB

Release files / pinventory-0.5.0.tar.gz

Download URL pinventory-0.5.0.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cb3ad47964184f066bcba069182379a906732d1bd88556132cb6308562549067
BLAKE2b-256 checksum
How to use checksums
a162e044628ed102e6b1d5ea234e502f3bfcb0d0d850fe48af999bde1b756ccc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pinventory-0.5.0-py3-none-any.whl

Download URL pinventory-0.5.0-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e3d3863c82c21c5c37b0581d9463c71eb021980298dba427fbfd1c925551264
BLAKE2b-256 checksum
How to use checksums
747d11152aeee7e19418ee6a4bf7ec79a74ef0b67207f0428cb6902198031a5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page