Fix Odd-length string in ansible-playbook
If you faced with: ERROR! Unexpected Exception: Odd-length string
It may be caused by the wrong line feeds in some files of your project.
They should be LF
, not CRLF
. To check change dir to your project root and do:
find . -type f -exec file {} \;
If you have some line with ASCII text, with CRLF line terminators
this it the reason! Normal files should have only ASCII text
(this means LF
) in output, example:
./file1: ASCII text
./file2.yml: ASCII text ...
Solving
You can use dos2unix
to convert (can be installed with apt-get
if you run Ubuntu or WSL 2 on Windows):
find . -type f -exec dos2unix {} \;