# Right way of developing dynamic inventory?

**URL:** <https://forum.ansible.com/t/right-way-of-developing-dynamic-inventory/28541>\
**Category:** Ansible Project\
**Created:** [September 10, 2018, 6:16pm UTC](https://forum.ansible.com/t/right-way-of-developing-dynamic-inventory/28541 "2018-09-10T18:16:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaldi](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@aaldi](https://forum.ansible.com/u/aaldi)\
**Post date:** [September 10, 2018, 6:16pm UTC](https://forum.ansible.com/t/right-way-of-developing-dynamic-inventory/28541/1 "2018-09-10T18:16:34Z")

</div>

Is there a guide for developing dynamic inventory? (beyond the one already given [here](https://docs.ansible.com/ansible/2.5/dev_guide/developing_inventory.html))

What I’m looking for is more constraints/conditions to abide by. What are the rules to follow to make sure the outputs are correct?

For example:

> I have a dynamic inventory based on a database, and it has 2 tables, one for ansible groups, and one for hosts.

> - If I add a host and a group at the same time, I’d add it in both tables. What happens if I remove it only from the host table? Does that break anything?

> - What happens when a host is not specified to a group, and I’m not returning a “ungrouped” group?

> - If I have a “\_meta” field when i return for “–list” option, do I even need “–host” option?

I wanted to dive deeper on this topic, but the documentation seemed limited. Would appreciate anyone directing me to resources.
