# \[devel\] Refactored inventory handling is now live, what it means for you

**URL:** <https://forum.ansible.com/t/devel-refactored-inventory-handling-is-now-live-what-it-means-for-you/11511>\
**Category:** Ansible Project\
**Created:** [May 6, 2012, 9:26pm UTC](https://forum.ansible.com/t/devel-refactored-inventory-handling-is-now-live-what-it-means-for-you/11511 "2012-05-06T21:26:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [May 6, 2012, 9:26pm UTC](https://forum.ansible.com/t/devel-refactored-inventory-handling-is-now-live-what-it-means-for-you/11511/1 "2012-05-06T21:26:26Z")

</div>

So as mentioned previously I have upgraded how inventory works today,  
and as a result taught the INI format how to do  
group variables and groups of groups -- this means that, as I wanted  
to do, I don't have to rely on the YAML format for anything.

I have noticed that a fair number of people ARE using the YAML file,  
so I don't see why we can't just keep this around for now, seeing the  
work is done.

What this means for you...

Users:

\* hopefully not much, but let us know if you see bugs  
\* INI, YAML, and external inventory are still working PER UNIT TESTS  
(this does not mean there might not be bugs)  
\* groups of groups are supported in the INI format  
\* group variables are supported in the INI format  
\* see [http://ansible.github.com/patterns.html](http://ansible.github.com/patterns.html) for information on new usage  
\* testing welcome

Developers working on core code, not modules:

\* look at inventory.py, group.py, host.py, and inventory\_parser\*.py to  
see how they work  
\* check your scripts and make sure I didn't break any APIs you were  
using. If I did, let me know, so I can fix them.  
\* there may be some bugs to ferret out involving the order at which  
variables hash-merge in the groups tree, so feel free to patch things  
if you find stuff.

Next steps:

\* (for me) write some more test coverage for these features  
\* (for me) remove the code that reads ~/.ssh/config and replace it  
with code that pays attention to inventory variables like:  
&nbsp;&nbsp;&nbsp;ansible\_ssh\_port  
&nbsp;&nbsp;&nbsp;ansible\_alias  
&nbsp;&nbsp;&nbsp;ansible\_user  
&nbsp;&nbsp;&nbsp;ansible\_sudo  
\* document that these variables are magic

If people have site-wide configuration for SSH port and sudo mode, the  
easiest thing for them to do is put this in their inventory file:

[all:vars]  
ansible\_user:timmy  
ansible\_sudo:root  
ansible\_ssh\_port:2112

NOTE: right now the only variable that is magic is ansible\_ssh\_port.

The user obviously being something people may want to leave to just  
-u, and not put a default in, if sharing a playbook with others.

I have promised folks task oriented more real-world docs about how to  
do all of this, so once this is done I'm planning on rewriting the  
playbook docs into a couple of different sections.

--Michael
