# Can the -i option of dynamic inventory accept a json directly instead of a executable file ?

**URL:** <https://forum.ansible.com/t/can-the-i-option-of-dynamic-inventory-accept-a-json-directly-instead-of-a-executable-file/18231>\
**Category:** Ansible Project\
**Created:** [May 14, 2015, 6:23pm UTC](https://forum.ansible.com/t/can-the-i-option-of-dynamic-inventory-accept-a-json-directly-instead-of-a-executable-file/18231 "2015-05-14T18:23:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ritesh\_Shetty](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@Ritesh\_Shetty](https://forum.ansible.com/u/Ritesh_Shetty)\
**Post date:** [May 14, 2015, 6:23pm UTC](https://forum.ansible.com/t/can-the-i-option-of-dynamic-inventory-accept-a-json-directly-instead-of-a-executable-file/18231/1 "2015-05-14T18:23:30Z")

</div>

My need is to call the ansible playbook with dynamic inventory and this inventory script needs to accept arguments . so depending on arguments the hosts will be different. I searched through the forrum and looks like the only option is to export variable which might not be a good idea in my case.  
So now i am trying to get the json out of a script by explicitly calling a custom method in dynamic inventory script and then trying to send this json to the playbook

Can the -i option of dynamic inventory accept a json directly instead of a executable file ?

I tried it and it doesnt work. I am using 1.8.2

---

<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:** [May 14, 2015, 6:41pm UTC](https://forum.ansible.com/t/can-the-i-option-of-dynamic-inventory-accept-a-json-directly-instead-of-a-executable-file/18231/2 "2015-05-14T18:41:58Z")

</div>

As your test indicated, the answer is no. You could create an executable script that just cats out the JSON though.
