# string not recognised in groups\_vars/all

**URL:** <https://forum.ansible.com/t/string-not-recognised-in-groups-vars-all/33282>\
**Category:** Ansible Project\
**Created:** [June 30, 2020, 10:28am UTC](https://forum.ansible.com/t/string-not-recognised-in-groups-vars-all/33282 "2020-06-30T10:28:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johana\_Galarza\_Monta](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@Johana\_Galarza\_Monta](https://forum.ansible.com/u/Johana_Galarza_Monta)\
**Post date:** [June 30, 2020, 10:28am UTC](https://forum.ansible.com/t/string-not-recognised-in-groups-vars-all/33282/1 "2020-06-30T10:28:56Z")

</div>

I have a the below in my groups vars, and in a role I am trying to add a conditional on `module-a` such as when: " ‘module-a’ in module" but keeps throwing me this error

{“msg”: "The conditional check ’ ‘module-a’ in modules’ failed. The error was: error while evaluating conditional ( ‘module-a’ in modules): Unable to look up a name or access an attribute in template string ({% if 'module-a in modules %} True {% else %} False {% endif %}).\nMake sure your variable name does not contain invalid characters like ‘-’: argument of type ‘AnsibleUndefined’ is not iterable…

but somehow it works when I put this in the playbook itself…

Did anyone had such an issue? Or… any idea why this works on the playbook but not under gorup\_vars/all…??

vars:  
module:

- module-a

---

<div class="post-metadata">

**Author:** ![jean-yves](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jean-yves](https://forum.ansible.com/u/jean-yves)\
**Post date:** [June 30, 2020, 10:43am UTC](https://forum.ansible.com/t/string-not-recognised-in-groups-vars-all/33282/2 "2020-06-30T10:43:24Z")

</div>

Dot, dash are operators in python on which ansible is based…

It is not a good idea to use them, but if you use them, there is some notices about it here :

[https://docs.ansible.com/ansible/latest/reference\_appendices/faq.html](https://docs.ansible.com/ansible/latest/reference_appendices/faq.html)

And there are issue :

[https://github.com/ansible/ansible/issues/56930](https://github.com/ansible/ansible/issues/56930)

So please, do not used them in variables… It should save you times

Regards,

---

<div class="post-metadata">

**Author:** ![Johana\_Galarza\_Monta](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@Johana\_Galarza\_Monta](https://forum.ansible.com/u/Johana_Galarza_Monta)\
**Post date:** [June 30, 2020, 11:58am UTC](https://forum.ansible.com/t/string-not-recognised-in-groups-vars-all/33282/3 "2020-06-30T11:58:50Z")

</div>

but that doesnt’t respond to my answer on why this works when it is in the playbook… and not when it is in groups-vars

---

<div class="post-metadata">

**Author:** ![Srinivas\_Naram](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@Srinivas\_Naram](https://forum.ansible.com/u/Srinivas_Naram)\
**Post date:** [June 30, 2020, 12:47pm UTC](https://forum.ansible.com/t/string-not-recognised-in-groups-vars-all/33282/4 "2020-06-30T12:47:44Z")

</div>

Check out the syntax of ‘all’ file. I feel the indentation is not right.
