I’m having issues I cannot seem to get past on my own or with Google searches…
Playbook:
- name: unicode issue
template: src=mytemplate.conf.j2 dest=/tmp/mytemplate.conf
Output -vvv:
<myserver.mydomain.com> EXEC /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-1371842658.09-66206923215967 && chmod a+rx $HOME/.ansible/tmp/ansible-1371842658.09-66206923215967 && echo $HOME/.ansible/tmp/ansible-1371842658.09-66206923215967’
Fatal: [myserver.mydomain.com] => {‘msg’: ‘unable to process as utf-8: /home/me/myproject/roles/myrole/templates/mytemplate.conf.j2’, ‘failed’: True}
FYI,
I don’t get the error when I remove the unicode symbol (ø) from mytemplate.conf.j2
also sprach Paul Hassinger <hassinger.paul@ipaul.com> [2013.06.21.2135 +0200]:
Fatal: [myserver.mydomain.com] => {'msg': 'unable to process as utf-8:
/home/me/myproject/roles/myrole/templates/mytemplate.conf.j2', 'failed':
True}
suggest you show the template
i can replicate with the ansible/test/sample.j2 template… Resolved if I remove “ø”. The template is as follows:
I pulled off the error handling in ansible/utils/template.py, and get the following error:
fatal: [myserver.mydomain.com] => {‘msg’: “‘utf8’ codec can’t decode byte 0xf8 in position 28: invalid start byte”, ‘failed’: True}
fatal: [myserver.mydomain.com] => {‘msg’: “‘utf8’ codec can’t decode byte 0xf8 in position 28: invalid start byte”, ‘failed’: True}
I should also point out that I get the message twice for each server just as above.
OK, I feel stupid now. The project’s file save encoding was reset. I was saving as a Cp1252 file encoding. Issue resolved. Sorry.