# Questions regarding inventory plugins

**URL:** <https://forum.ansible.com/t/questions-regarding-inventory-plugins/28432>\
**Category:** Ansible Developer\
**Created:** [August 27, 2018, 9:34pm UTC](https://forum.ansible.com/t/questions-regarding-inventory-plugins/28432 "2018-08-27T21:34:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luke\_Murphy](https://avatars.discourse-cdn.com/v4/letter/l/ee59a6/32.png) [@Luke\_Murphy](https://forum.ansible.com/u/Luke_Murphy)\
**Post date:** [August 27, 2018, 9:34pm UTC](https://forum.ansible.com/t/questions-regarding-inventory-plugins/28432/1 "2018-08-27T21:34:49Z")

</div>

Hi folks,

Following #44721[1], I've been investigating how to write a Linode  
inventory plugin. Along with the questions in that ticket (happy if  
anyone can help answer!) I have some more general questions:

\* What is the return value of inventory plugins? They all seem to be different.  
&nbsp;&nbsp;Is there some standard format? For example, a JSON response format.

\* Is there are best practice for writing these plugins? Looking at the  
&nbsp;&nbsp;plugin list[1], they all seem to take different approaches with  
&nbsp;&nbsp;filters, groups and querying parameters.

My assumption is that I should try to mimic what the cloud provider  
exposes. So, in the case of Linode, as the existing Linode inventory  
script does, we expose linode IDs, datacenter IDs and group names, etc.  
This some how feels quite ad-hoc and perhaps confusing to users who will  
use inventory plugins ('what do I actually get from this plugin to  
target!?').

Here's all the documentation I can find right now:

> [https://docs.ansible.com/ansible/latest/plugins/inventory.html](https://docs.ansible.com/ansible/latest/plugins/inventory.html)

I'd like to improve this, if possible, with the following discussion.

Thanks,

Luke

[1]: [https://github.com/ansible/ansible/issues/44721](https://github.com/ansible/ansible/issues/44721)  
[2]: [https://docs.ansible.com/ansible/latest/plugins/inventory.html#plugin-list](https://docs.ansible.com/ansible/latest/plugins/inventory.html#plugin-list)

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [August 27, 2018, 9:43pm UTC](https://forum.ansible.com/t/questions-regarding-inventory-plugins/28432/2 "2018-08-27T21:43:54Z")

</div>

There is an open PR to provide a little more documentation for users converting an inventory script to an inventory plugin:

[https://github.com/ansible/ansible/pull/44727](https://github.com/ansible/ansible/pull/44727)

That might be of use (Note: I haven’t yet read through the changes)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [August 27, 2018, 11:41pm UTC](https://forum.ansible.com/t/questions-regarding-inventory-plugins/28432/3 "2018-08-27T23:41:43Z")

</div>

To clarify, unlike inventory scripts, inventory plugins don't 'return'  
a format, they update the inventory itself.

---

<div class="post-metadata">

**Author:** ![Luke\_Murphy](https://avatars.discourse-cdn.com/v4/letter/l/ee59a6/32.png) [@Luke\_Murphy](https://forum.ansible.com/u/Luke_Murphy)\
**Post date:** [August 29, 2018, 9:18am UTC](https://forum.ansible.com/t/questions-regarding-inventory-plugins/28432/4 "2018-08-29T09:18:52Z")

</div>

Thanks to you both! That documentation PR is certainly helpful, I think  
I have enough to push forward writing that inventory plugin now 🙂

---

<div class="post-metadata">

**Author:** ![Luke\_Murphy](https://avatars.discourse-cdn.com/v4/letter/l/ee59a6/32.png) [@Luke\_Murphy](https://forum.ansible.com/u/Luke_Murphy)\
**Post date:** [October 9, 2018, 12:02pm UTC](https://forum.ansible.com/t/questions-regarding-inventory-plugins/28432/5 "2018-10-09T12:02:26Z")

</div>

To update, this inventory plugin arrived!

Please consider using it vs. the old Linode inventory script.

[https://github.com/ansible/ansible/pull/45902](https://github.com/ansible/ansible/pull/45902)

Will be released in 2.8, now in `devel`.

Best,

Luke
