# YAML inventory with group name "DEV" causes error

**URL:** <https://forum.ansible.com/t/yaml-inventory-with-group-name-dev-causes-error/32827>\
**Category:** Ansible Developer\
**Created:** [April 30, 2020, 4:57pm UTC](https://forum.ansible.com/t/yaml-inventory-with-group-name-dev-causes-error/32827 "2020-04-30T16:57:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tdev\_Feeds](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@Tdev\_Feeds](https://forum.ansible.com/u/Tdev_Feeds)\
**Post date:** [April 30, 2020, 4:57pm UTC](https://forum.ansible.com/t/yaml-inventory-with-group-name-dev-causes-error/32827/1 "2020-04-30T16:57:23Z")

</div>

I’m converting our existing INI inventory to YAML. The reason is that I cannot seem to get variables like “{{ myvar }}” working within an INI inventory and have found no documentation that says INI format supports variables.

Now, we have a group defined as “DEV”. This worked in the INI format. HOWEVER, it causes errors in YAML format.

`all: hosts: localhost: children: foo_group: children: my_group_name: my_group_name: hosts: myhost: vars: my_var: foo`

In the example above, if I change “my\_group\_name” to “DEV” or “dev”, I get the following error.

`ERROR! Attempting to decrypt but no vault secrets found`

I’m verifying the inventory using the following command.

`$ ansible-inventory -i inventory.yml --list`

Is this a bug or a reserved word? Why would it work in INI and not YAML?

Thanks in advance.

---

<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:** [April 30, 2020, 5:05pm UTC](https://forum.ansible.com/t/yaml-inventory-with-group-name-dev-causes-error/32827/2 "2020-04-30T17:05:37Z")

</div>

Try converting it to YAML using ansible-inventory itself:

ansible-inventory -i inventory.ini --list --yaml --export

I think you probably want something like this:

all:  
hosts:  
localhost: {}  
children:  
foo\_group:  
children:  
my\_group\_name:  
hosts:  
myhost: {}  
vars:  
my\_var: foo

---

<div class="post-metadata">

**Author:** ![Tdev\_Feeds](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@Tdev\_Feeds](https://forum.ansible.com/u/Tdev_Feeds)\
**Post date:** [April 30, 2020, 5:23pm UTC](https://forum.ansible.com/t/yaml-inventory-with-group-name-dev-causes-error/32827/3 "2020-04-30T17:23:48Z")

</div>

Thank you for your quick response. I was playing with the YAML indentation to see if that was a factor. It isn’t. So your example format causes the same issue. Export fails as well.

After playing around more, I can get vars to work in INI. I was simply missing quotes. \<face\_palm/\> I think the issue is with the “ansible-inventory” command. If I run a playbook using “ansible-playbook” and the group named “DEV”, the vars work in INI and YAML. o\_O?

Forgot to note the version I’m using.

`$ ansible --version ansible 2.9.7 config file = /etc/ansible/ansible.cfg configured module search path = [u'/home/myuser/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/dist-packages/ansible executable location = /usr/bin/ansible python version = 2.7.17 (default, Nov 7 2019, 10:07:09) [GCC 7.4.0]`
