# Inconsistent variables parser for ini inventory

**URL:** <https://forum.ansible.com/t/inconsistent-variables-parser-for-ini-inventory/14783>\
**Category:** Ansible Project\
**Created:** [March 15, 2014, 5:18pm UTC](https://forum.ansible.com/t/inconsistent-variables-parser-for-ini-inventory/14783 "2014-03-15T17:18:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oleg\_Bulatov](https://avatars.discourse-cdn.com/v4/letter/o/8edcca/32.png) [@Oleg\_Bulatov](https://forum.ansible.com/u/Oleg_Bulatov)\
**Post date:** [March 15, 2014, 5:18pm UTC](https://forum.ansible.com/t/inconsistent-variables-parser-for-ini-inventory/14783/1 "2014-03-15T17:18:22Z")

</div>

Hi!

I found that variables for hosts and for groups in the ini file are handled differently:  
[https://github.com/ansible/ansible/blob/devel/lib/ansible/inventory/ini.py#L127-L140](https://github.com/ansible/ansible/blob/devel/lib/ansible/inventory/ini.py#L127-L140)  
[https://github.com/ansible/ansible/blob/devel/lib/ansible/inventory/ini.py#L196-L201](https://github.com/ansible/ansible/blob/devel/lib/ansible/inventory/ini.py#L196-L201)

It would be nice to extract the method from the first block, and reuse it in the second.

This change will allow to define arrays in […:vars] block:

[groupname]  
[example.com](http://example.com) targets=“[‘aaa’, ‘bbb’, ‘ccc’]” # this is array

[groupname]  
[example.com](http://example.com)  
[groupname:vars]  
targets=[‘aaa’, ‘bbb’, ‘ccc’] # for now, this is string

Are there any reasons to keep this behaviour?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [March 17, 2014, 1:50pm UTC](https://forum.ansible.com/t/inconsistent-variables-parser-for-ini-inventory/14783/2 "2014-03-17T13:50:16Z")

</div>

I believe I commented on a pull request already that I’m ok supporting this, though I’d still prefer to see folks use group\_vars/ and host\_vars/ to simplify their main inventory most of the time.
