# Ansible paybook error : Make sure your variable name does not contain invalid characters like '-'

**URL:** <https://forum.ansible.com/t/ansible-paybook-error-make-sure-your-variable-name-does-not-contain-invalid-characters-like/22159>\
**Category:** Ansible Project\
**Created:** [July 29, 2016, 6:03am UTC](https://forum.ansible.com/t/ansible-paybook-error-make-sure-your-variable-name-does-not-contain-invalid-characters-like/22159 "2016-07-29T06:03:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Omkar\_Jadhav](https://avatars.discourse-cdn.com/v4/letter/o/ed8c4c/32.png) [@Omkar\_Jadhav](https://forum.ansible.com/u/Omkar_Jadhav)\
**Post date:** [July 29, 2016, 6:03am UTC](https://forum.ansible.com/t/ansible-paybook-error-make-sure-your-variable-name-does-not-contain-invalid-characters-like/22159/1 "2016-07-29T06:03:16Z")

</div>

HI,

I am using Ansible - 2.1.0.0. part of my code is as below  
`

- shell: /etc/init.d/named restart  
when: (‘FAILED’ not in zoneconfig.stdout) and (‘neither’ not in zoneconfig.stdout) and (‘FAILED’ not in echofail.stdout) and (‘SUCCESSFUL’ in echopass.stdout\_lines) and (‘SUCCESSFUL’ in zoneconfig.stdout)  
ignore\_errors: True  
register: namedrestart

- debug: var=namedrestart.stdout\_lines  
when: (‘FAILED’ not in zoneconfig.stdout) and (‘neither’ not in zoneconfig.stdout) and (‘FAILED’ not in echofail.stdout) and (‘SUCCESSFUL’ in echopass.stdout\_lines) and (‘SUCCESSFUL’ in zoneconfig.stdout)  
ignore\_errors: True

- shell: /etc/init.d/named status  
when: (‘FAILED’ not in zoneconfig.stdout) and (‘neither’ not in zoneconfig.stdout) and (‘FAILED’ not in echofail.stdout) and (‘SUCCESSFUL’ in echopass.stdout\_lines) and (‘SUCCESSFUL’ in zoneconfig.stdout)  
ignore\_errors: True  
register: namedstatus

- debug: var=namedstatus.stdout\_lines  
when: (‘FAILED’ not in zoneconfig.stdout) and (‘neither’ not in zoneconfig.stdout) and (‘FAILED’ not in echofail.stdout) and (‘SUCCESSFUL’ in echopass.stdout\_lines) and (‘SUCCESSFUL’ in zoneconfig.stdout)  
ignore\_errors: True

`  
which in turns giving me error :

`

TASK [command] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [10.139.73.152]: FAILED! =\> {“failed”: true, “msg”: “The conditional check ‘(‘FAILED’ not in zoneconfig.stdout) and (‘neither’ not in zoneconfig.stdout) and (‘FAILED’ not in echofail.stdout) and (‘SUCCESSFUL’ in echopass.stdout\_lines) and (‘SUCCESSFUL’ in zoneconfig.stdout)’ failed. The error was: error while evaluating conditional ((‘FAILED’ not in zoneconfig.stdout) and (‘neither’ not in zoneconfig.stdout) and (‘FAILED’ not in echofail.stdout) and (‘SUCCESSFUL’ in echopass.stdout\_lines) and (‘SUCCESSFUL’ in zoneconfig.stdout)): Unable to look up a name or access an attribute in template string ({% if (‘FAILED’ not in zoneconfig.stdout) and (‘neither’ not in zoneconfig.stdout) and (‘FAILED’ not in echofail.stdout) and (‘SUCCESSFUL’ in echopass.stdout\_lines) and (‘SUCCESSFUL’ in zoneconfig.stdout) %} True {% else %} False {% endif %}).\nMake sure your variable name does not contain invalid characters like ‘-’: argument of type ‘StrictUndefined’ is not iterable\n\nThe error appears to have been in ‘/etc/ansible/named\_configtest/configtest\_named.yml’: line 47, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - shell: /etc/init.d/named restart\n ^ here\n”}  
…ignoring

TASK [debug] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [10.139.73.152]: FAILED! =\> {“failed”: true, “msg”: “The conditional check ‘(‘FAILED’ not in zoneconfig.stdout) and (‘neither’ not in zoneconfig.stdout) and (‘FAILED’ not in echofail.stdout) and (‘SUCCESSFUL’ in echopass.stdout\_lines) and (‘SUCCESSFUL’ in zoneconfig.stdout)’ failed. The error was: error while evaluating conditional ((‘FAILED’ not in zoneconfig.stdout) and (‘neither’ not in zoneconfig.stdout) and (‘FAILED’ not in echofail.stdout) and (‘SUCCESSFUL’ in echopass.stdout\_lines) and (‘SUCCESSFUL’ in zoneconfig.stdout)): Unable to look up a name or access an attribute in template string ({% if (‘FAILED’ not in zoneconfig.stdout) and (‘neither’ not in zoneconfig.stdout) and (‘FAILED’ not in echofail.stdout) and (‘SUCCESSFUL’ in echopass.stdout\_lines) and (‘SUCCESSFUL’ in zoneconfig.stdout) %} True {% else %} False {% endif %}).\nMake sure your variable name does not contain invalid characters like ‘-’: argument of type ‘StrictUndefined’ is not iterable\n\nThe error appears to have been in ‘/etc/ansible/named\_configtest/configtest\_named.yml’: line 51, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n register: namedrestart\n - debug: var=namedrestart.stdout\_lines\n ^ here\n”}  
…ignoring

`

Kindly let me know how this can be resolved or is there any work around present.
