string not recognised in groups_vars/all

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

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

And there are issue :

https://github.com/ansible/ansible/issues/56930

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

Regards,

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

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