{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/11541","labels_url":"https://api.github.com/repos/ansible/ansible/issues/11541/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/11541/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/11541/events","html_url":"https://github.com/ansible/ansible/issues/11541","id":94183359,"number":11541,"title":"Variables values containing tildes or accents cause a failure","user":{"login":"rodolfojcj","id":458749,"avatar_url":"https://avatars.githubusercontent.com/u/458749?v=3","gravatar_id":"","url":"https://api.github.com/users/rodolfojcj","html_url":"https://github.com/rodolfojcj","followers_url":"https://api.github.com/users/rodolfojcj/followers","following_url":"https://api.github.com/users/rodolfojcj/following{/other_user}","gists_url":"https://api.github.com/users/rodolfojcj/gists{/gist_id}","starred_url":"https://api.github.com/users/rodolfojcj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rodolfojcj/subscriptions","organizations_url":"https://api.github.com/users/rodolfojcj/orgs","repos_url":"https://api.github.com/users/rodolfojcj/repos","events_url":"https://api.github.com/users/rodolfojcj/events{/privacy}","received_events_url":"https://api.github.com/users/rodolfojcj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-10T00:38:53Z","updated_at":"2015-07-10T01:01:38Z","closed_at":null,"body":"Hi!\r\n\r\nGiven a directory with the following tree-like content for a playbook:\r\n\r\n    dummy-playbook/\r\n    |-- main.yml\r\n    `-- mypeople.yml\r\n\r\nAnd given a directory with the following tree-like content for a role:\r\n\r\n    roles/dummy-role/\r\n    |-- tasks\r\n    |   |-- main.yml\r\n    |   `-- people-provisioning.yml\r\n    `-- templates\r\n        `-- templaterole.j2\r\n\r\nAnd here the content for each of those files:\r\n\r\n_dummy-playbook/main.yml_:\r\n\r\n    ---\r\n    # Ansible dummy playbook\r\n    - hosts: my-dummy-host\r\n      vars_files:\r\n        - mypeople.yml\r\n      roles:\r\n        - dummy-role\r\n\r\n_dummy-playbook/mypeople.yml_:\r\n\r\n    ---\r\n    people:\r\n      - internalcode: ABC123\r\n        fullname: \"Juan Pérez Peña\"\r\n\r\n_roles/dummy-role/tasks/main.yml_:\r\n\r\n    ---\r\n    # Dummy role main tasks\r\n    - include: people-provisioning.yml\r\n      when: people\r\n\r\n_roles/dummy-role/tasks/people-provisioning.yml_:\r\n\r\n    ---\r\n    # Dummy role provisioning tasks\r\n    - name: Generate people file\r\n      template: src=templaterole.j2 dest=/tmp/people.txt\r\n      with_items: '{{ people }}'\r\n\r\n_roles/dummy-role/templates/templaterole.j2_:\r\n\r\n    # {{ ansible_managed }}\r\n    {{ item.internalcode }}\r\n    {{ item.fullname }}\r\n\r\nWhen I run the playbook with the following command:\r\n    ansible-playbook -vvv ~/playbooks/dummy-playbook/main.yml\r\n\r\nI get this error:\r\n\r\n    TASK: [dummy-role | Generate people file] ************************************* \r\n    fatal: [my-dummy-host] => Failed to template {% if [{'fullname': u'Juan P\\xe9rez Pe\\xf1a', 'internalcode': 'ABC123'}] %} True {% else %} False {% endif %}: template error while templating string: expected token ',', got 'string'\r\n\r\n    FATAL: all hosts have already failed -- aborting\r\n\r\n    PLAY RECAP ******************************************************************** \r\n           to retry, use: --limit @/home/osg/main.retry\r\n\r\n    my-dummy-host            : ok=1    changed=0    unreachable=1    failed=0   \r\n\r\nI did the following:\r\n\r\n* Changed the double quotes around the value \"Juan Pérez Peña\" to single quotes or to no quotes at all, but it failed too\r\n* Changed the value \"Juan Pérez Peña\" to something like \"Juan Perez\" and it worked fine\r\n* Rewrote the playbook to a simpler version with no roles and no _\"when\" conditions_ and it worked fine\r\n* Reviewed the codification of the file _dummy-playbook/mypeople.yml_ and there's no difference in the failed output between UTF-8 and ISO-8859-15\r\n* Removed the condition _\"when: people\"_ in the file _roles/dummy-role/tasks/main.yml_ and it worked fine\r\n\r\nThen, it seems to me there's some kind of bug in the implementation of the _when condition_.\r\n\r\nCould someone please review this case?\r\nThanks in advance!"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/120189310","html_url":"https://github.com/ansible/ansible/issues/11541#issuecomment-120189310","issue_url":"https://api.github.com/repos/ansible/ansible/issues/11541","id":120189310,"user":{"login":"rodolfojcj","id":458749,"avatar_url":"https://avatars.githubusercontent.com/u/458749?v=3","gravatar_id":"","url":"https://api.github.com/users/rodolfojcj","html_url":"https://github.com/rodolfojcj","followers_url":"https://api.github.com/users/rodolfojcj/followers","following_url":"https://api.github.com/users/rodolfojcj/following{/other_user}","gists_url":"https://api.github.com/users/rodolfojcj/gists{/gist_id}","starred_url":"https://api.github.com/users/rodolfojcj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rodolfojcj/subscriptions","organizations_url":"https://api.github.com/users/rodolfojcj/orgs","repos_url":"https://api.github.com/users/rodolfojcj/repos","events_url":"https://api.github.com/users/rodolfojcj/events{/privacy}","received_events_url":"https://api.github.com/users/rodolfojcj/received_events","type":"User","site_admin":false},"created_at":"2015-07-10T01:01:38Z","updated_at":"2015-07-10T01:01:38Z","body":"Regarding the environment I tested on, it is:\r\n\r\n* Workstation with Ansible versions 1.9.1 and 1.9.2 and Python version 2.7.6 on Ubuntu 14.04.1 with Linux kernel version 3.19.0-21\r\n* Target host (named _my-dummy-host_) has CentOS 5 with Python version 2.4.3, Python SimpleJSON version 2.0.9 and Linux kernel version 2.6.18"}}