Ansible, GCE, command: make and weird issues

Hi,

The weirdest problem.
When I run the following from my Mac laptop, all good.
When I run on from a VM on GCE (Google Cloud Engine), I get the following errors.
I guess it’s a problem with something related to ansible itself, but I can’t find out what it is.

`

Tasks

  • name: Download OpenCV3 Source
    get_url: url=https://github.com/Itseez/opencv/archive/3.0.0-beta.zip dest=/tmp/opencv-3.0.0-beta.zip
  • name: Create A Folder - OpenCV3
    file: path=/tmp/opencv-3.0.0-beta state=directory
  • name: Unarchive OpenCV3
    unarchive: src=/tmp/opencv-3.0.0-beta.zip dest=/tmp copy=no creates=/tmp/opencv-3.0.0-beta/LICENSE
  • name: Create a Folder - OpenCV3/Build
    file: path=/tmp/opencv-3.0.0-beta/build state=directory
    notify:
  • CMake OpenCV
  • Make
  • Make Install

Handlers

Looks like a character encoding issue. One of your traceback errors is:

UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe2 in position 3672: ordinal not in range(128)

And the prior ansible command was setting LANG=C and LC_TYPE=C

…ConnectTimeout=15 PasswordAuthentication=no ‘LANG=C LC_CTYPE=C /usr/bin/python /root/.ansible/tmp/ansible-tmp-1424858592.85-146021682777198/command; rm -rf /root/.ansible/tmp/ansible-tmp-1424858592.85-146021682777198/ >/dev/null 2>&1’

I don’t know how to change that, but if you can set it to UTF8, I bet your problems will go away.

Try using the environment directive to set the locale for the task.

You guys are awesome, the issue was fixed.
The solution:
Edit /etc/ansible/ansible.cfg and comment out the module_lang:

#module_lang = C

A little explanation:
The issue was that the connection to the servers set the lang to be C, so disabling it changed it to default:

GOOD: /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8

instead of:

BAD: /bin/sh -c 'LANG=C LC_CTYPE=C

Thanks, hope it helps - god knows I went crazy over this.