# "--host" functionality for a dynamic inventory

**URL:** <https://forum.ansible.com/t/host-functionality-for-a-dynamic-inventory/16537>\
**Category:** Ansible Developer\
**Created:** [October 17, 2014, 2:45pm UTC](https://forum.ansible.com/t/host-functionality-for-a-dynamic-inventory/16537 "2014-10-17T14:45:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tomas\_Karasek](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@Tomas\_Karasek](https://forum.ansible.com/u/Tomas_Karasek)\
**Post date:** [October 17, 2014, 2:45pm UTC](https://forum.ansible.com/t/host-functionality-for-a-dynamic-inventory/16537/1 "2014-10-17T14:45:48Z")

</div>

Hello,  
is it necessary to implement the --host functionality when my dynamic inventroy script returns all the hosts in \_meta?

I refer to  
[http://docs.ansible.com/developing\_inventory.html#tuning-the-external-inventory-script](http://docs.ansible.com/developing_inventory.html#tuning-the-external-inventory-script)

I just briefly tried with Ansible 1.8 and it seems that when I have \_meta populated, it does not invoke the inventory script with --host even when I target only one host.

Can I just

“raise NotImplementedError(“everything is in \_meta when you --list”)”

for the --host arg?

Thanks for answering!

Best Regards,  
Tomas Karasek

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [October 17, 2014, 2:48pm UTC](https://forum.ansible.com/t/host-functionality-for-a-dynamic-inventory/16537/2 "2014-10-17T14:48:50Z")

</div>

​no, the parsing code will not run --host when you return the \_meta key for  
--list  
what I do as a failsafe, is just returning an empty json dict {} when  
calling --host​

---

<div class="post-metadata">

**Author:** ![Tomas\_Karasek](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@Tomas\_Karasek](https://forum.ansible.com/u/Tomas_Karasek)\
**Post date:** [October 17, 2014, 2:50pm UTC](https://forum.ansible.com/t/host-functionality-for-a-dynamic-inventory/16537/3 "2014-10-17T14:50:36Z")

</div>

Thanks for prompt reply! Good idea with the empty dict.
