This repository hosts my personal Ansible inventory collection.
This collection includes a JSON plugin to read an inventory from a particular JSON structure in a file.
Click on the name of a plugin or module to view that content's documentation:
- Plugins:
Before using this collection, you need to install it with the Ansible Galaxy CLI:
$ ansible-galaxy collection install nleiva.inventory
You can reach the sample JSON inventory file for example via this repository link to add it to your inventory.yml file:
# inventory.yml
plugin: nleiva.inventory.json
link_to_inventory: https://raw.githubusercontent.com/nleiva/ansible-inventory-plugin/main/hosts.json
validate_certs: true
With the inventory.yml file in place, you can run ansible-inventory -i inventory.yml
to get the inventory populated:
$ ansible-inventory -i inventory.yml --graph
@all:
|--@routers:
| |--@ios:
| | |--sandbox-iosxe-latest-1.cisco.com
| |--@iosxr:
| | |--sandbox-iosxr-1.cisco.com
| |--@nxos:
| | |--sandbox-nxos-1.cisco.com
|--@ungrouped:
We need to TAG the version with a version number greater than the latest one:
export TAG=1.0.6
And then build:
make build
It will end up in the Inventory collection Galaxy page if you have access to the namespace.
For more information about Inventory plugins, check out the resources in this list.
GNU General Public License v3.0 or later
See LICENCE to see the full text.