# Unifying inventory file format

**URL:** <https://forum.ansible.com/t/unifying-inventory-file-format/13781>\
**Category:** Ansible Project\
**Created:** [October 27, 2013, 5:47pm UTC](https://forum.ansible.com/t/unifying-inventory-file-format/13781 "2013-10-27T17:47:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francois\_Durand](https://avatars.discourse-cdn.com/v4/letter/f/90ced4/32.png) [@Francois\_Durand](https://forum.ansible.com/u/Francois_Durand)\
**Post date:** [October 27, 2013, 5:47pm UTC](https://forum.ansible.com/t/unifying-inventory-file-format/13781/1 "2013-10-27T17:47:18Z")

</div>

Hello,

Everything in ansible is yaml, except inventory file which is INI, and inventory scripts which output JSON.

Wouldn’t it be nice and more consistent to have inventory files in yaml, and inventory scripts outputing yaml ?

It would make it possible, for instance, to redirect the output of an inventory script to a file to have a snapshot inventory file, or to make it easy to create inventory scripts mixing static inventory files and dynamic content.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 28, 2013, 12:29pm UTC](https://forum.ansible.com/t/unifying-inventory-file-format/13781/2 "2013-10-28T12:29:48Z")

</div>

You’re sending a lot of emails today 🙂

Nope, YAML doesn’t lend itself well to inventory.

YAML naturally defines a treeish structure, and groups are actually not a tree.

However if you want to, you could use an external inventory script and keep it in whatever format you like.

We used to have YAML inventory as an option in the early days but it was _quite_ a mess, and included it as an inventory script for a while. It was removed because it didn’t keep parity with the rest of the  
main code.

Ultimately I think keeping everything in the same format is a mistake – it’s better to keep everything in the _best_ format.

Inventory scripts actually output JSON, because it’s more efficient – so the snapshot argument doesn’t quite hold anyway.
