I have experienced that Ansible 2.0.0.2 forwards the LANG and LC_ALL variables from the controller machine to the hosts.
I hadn’t experienced this behaviour with versions 1.9.X, and this results in modules depending on literals (e.g: yum, searching for “Nothing to do” ).
I have experienced that setting the variable ANSIBLE_MODULE_LANG to “C”, “en-us.UTF-8” or even “C” solves the problem, but if the default value of the parameter is “C” (as the documentation says so) it should work without setting the value.
I have found this issue and it’s been closed and redirected to this list. The fact is that with Ansible 2.X this will happen to many people now.
I would like to start a discussion to determine if this behaviour is the right one or should be changed. Personally I think it is misbehaving as it is not enforcing the default value.
Env vars get set from the default in ansible.cfg or the var you
mention, we changed from a default of 'C' to "en-us.UTF-8" a while
back to deal with unicode filesystems, any other value you are seeing
should be because someone explicitly changed this.
In Ansible 2.0.0.2, if I don’t define ANSIBLE_MODULE_LANG or module_lang in the defaults section of ansible.cfg, then the LANG variables are, by default, forwarded from the locale variables of the controller machine.
So, if I don’t set any value for the variable, the LANG and LC used for communication should be “C”, isn’t it? It that assumption is correct, the current behaviour (forwarding the local value of the controller) could be a bug.
Running ansible with '-m shell -a "echo \$LANG"'
results in
IP_CENSORED | SUCCESS | rc=0 >>
de_DE.UTF-8
ansible 2.1.0 (devel e3a6accc1d)
last updated 2016/01/20 08:57:23 (GMT +200)
Running the same on 1.9.4 I get en_US.UTF-8.
In both cases variables from ssh SendEnv config will also be transfered. In 1.9.4 LANG is still overwritten.
module_lang in defaults section of ansible.cfg replaces the environment values as expected. (Both 1.9.4 and 2.x)
I just added /bin/sh -c back to 2.0 as there were other breakages.
What is the user's default shell? I suspect this was only hitting only
'non bash/sh' shells.