Inconsistent variables parser for ini inventory

36 views
Skip to first unread message

Oleg Bulatov

unread,
Mar 15, 2014, 1:18:22 PM3/15/14
to ansible...@googlegroups.com
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#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 targets="['aaa', 'bbb', 'ccc']"  # this is array

[groupname]
example.com
[groupname:vars]
targets=['aaa', 'bbb', 'ccc']  # for now, this is string

Are there any reasons to keep this behaviour?

Michael DeHaan

unread,
Mar 17, 2014, 9:50:16 AM3/17/14
to ansible...@googlegroups.com
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.




--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/83fedef5-9c11-48a6-81b9-2043815c0d42%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages