# Variables can't contain '-' char?

**URL:** <https://forum.ansible.com/t/variables-cant-contain-char/13598>\
**Category:** Ansible Project\
**Created:** [October 3, 2013, 5:55am UTC](https://forum.ansible.com/t/variables-cant-contain-char/13598 "2013-10-03T05:55:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yaniv\_Kaul](https://avatars.discourse-cdn.com/v4/letter/y/bc79bd/32.png) [@Yaniv\_Kaul](https://forum.ansible.com/u/Yaniv_Kaul)\
**Post date:** [October 3, 2013, 5:55am UTC](https://forum.ansible.com/t/variables-cant-contain-char/13598/1 "2013-10-03T05:55:53Z")

</div>

Variable named ‘res\_file’ works.  
Variable named ‘res-file’ fails miserably:

fatal: [[cluster267-n1.example.com](http://cluster267-n1.example.com)] =\> Traceback (most recent call last):  
File “/usr/lib/python2.6/site-packages/ansible/runner/ **init**.py”, line 364, in \_executor  
exec\_rc = self.\_executor\_internal(host, new\_stdin)  
File “/usr/lib/python2.6/site-packages/ansible/runner/ **init**.py”, line 443, in \_executor\_internal  
return self.\_executor\_internal\_inner(host, self.module\_name, self.module\_args, inject, port, complex\_args=complex\_args)  
File “/usr/lib/python2.6/site-packages/ansible/runner/ **init**.py”, line 594, in \_executor\_internal\_inner  
module\_args = template.template(self.basedir, module\_args, inject)  
File “/usr/lib/python2.6/site-packages/ansible/utils/template.py”, line 308, in template  
varname = template\_from\_string(basedir, varname, vars)  
File “/usr/lib/python2.6/site-packages/ansible/utils/template.py”, line 497, in template\_from\_string  
res = jinja2.utils.concat(t.root\_render\_func(t.new\_context(\_jinja2\_vars(basedir, vars, t.globals), shared=True)))  
File “”, line 10, in root  
TypeError: unsupported operand type(s) for -: ‘StrictUndefined’ and ‘StrictUndefined’

ansible-1.2.3-2.el6.noarch on CentOS 6.4.

TIA,  
Y.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 3, 2013, 7:32am UTC](https://forum.ansible.com/t/variables-cant-contain-char/13598/2 "2013-10-03T07:32:19Z")

</div>

You should definitely try this on 1.3, which is the latest release verson, but the problem here is one of your variables is undefined.

Ansible 1.3 contains a feature to raise a nice error message when one of your variables is undefined.

Variable names should absolutely follow standard variable name conventions, and this is also documented in the pending docs push so other users won’t make the same mistake.

foo-x is not a valid variable name.
