{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/15138","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/15138/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/15138/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/15138/events","html_url":"https://github.com/ansible/ansible/issues/15138","id":143232862,"number":15138,"title":"LC_ALL sets when running ansible with become user (sudo) on remote host","user":{"login":"bortek","id":9476606,"avatar_url":"https://avatars.githubusercontent.com/u/9476606?v=3","gravatar_id":"","url":"https://api.github.com/users/bortek","html_url":"https://github.com/bortek","followers_url":"https://api.github.com/users/bortek/followers","following_url":"https://api.github.com/users/bortek/following{/other_user}","gists_url":"https://api.github.com/users/bortek/gists{/gist_id}","starred_url":"https://api.github.com/users/bortek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bortek/subscriptions","organizations_url":"https://api.github.com/users/bortek/orgs","repos_url":"https://api.github.com/users/bortek/repos","events_url":"https://api.github.com/users/bortek/events{/privacy}","received_events_url":"https://api.github.com/users/bortek/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible/labels/feature_idea","name":"feature_idea","color":"006b75"}],"state":"closed","locked":false,"assignee":{"login":"jimi-c","id":26403,"avatar_url":"https://avatars.githubusercontent.com/u/26403?v=3","gravatar_id":"","url":"https://api.github.com/users/jimi-c","html_url":"https://github.com/jimi-c","followers_url":"https://api.github.com/users/jimi-c/followers","following_url":"https://api.github.com/users/jimi-c/following{/other_user}","gists_url":"https://api.github.com/users/jimi-c/gists{/gist_id}","starred_url":"https://api.github.com/users/jimi-c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimi-c/subscriptions","organizations_url":"https://api.github.com/users/jimi-c/orgs","repos_url":"https://api.github.com/users/jimi-c/repos","events_url":"https://api.github.com/users/jimi-c/events{/privacy}","received_events_url":"https://api.github.com/users/jimi-c/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/ansible/ansible/milestones/6","html_url":"https://github.com/ansible/ansible/milestones/2.1.0","labels_url":"https://api.github.com/repos/ansible/ansible/milestones/6/labels","id":995714,"number":6,"title":"2.1.0","description":"","creator":{"login":"abadger","id":209242,"avatar_url":"https://avatars.githubusercontent.com/u/209242?v=3","gravatar_id":"","url":"https://api.github.com/users/abadger","html_url":"https://github.com/abadger","followers_url":"https://api.github.com/users/abadger/followers","following_url":"https://api.github.com/users/abadger/following{/other_user}","gists_url":"https://api.github.com/users/abadger/gists{/gist_id}","starred_url":"https://api.github.com/users/abadger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abadger/subscriptions","organizations_url":"https://api.github.com/users/abadger/orgs","repos_url":"https://api.github.com/users/abadger/repos","events_url":"https://api.github.com/users/abadger/events{/privacy}","received_events_url":"https://api.github.com/users/abadger/received_events","type":"User","site_admin":false},"open_issues":112,"closed_issues":130,"state":"open","created_at":"2015-02-25T19:26:53Z","updated_at":"2016-04-20T21:04:05Z","due_on":null,"closed_at":null},"comments":30,"created_at":"2016-03-24T12:36:00Z","updated_at":"2016-04-20T21:04:05Z","closed_at":"2016-04-20T21:04:05Z","body":"I am using Ansible to execute remote java commands on multiple servers using sudo like this\r\n\r\nansible -o -i /my/hosts/file myhostname -m shell -a \"java -jar myfile.jar\" -b --become-user=remote_user --ask-become-pass -k\r\n\r\nSince ver 2.0.0 of Ansible for some reason it adds \"LC_ALL=en_US.UTF-8\" to the process it starts. This causes a major issue since Java application reads locale from env variable and uses it instead of some other locale set in Java.\r\n\r\nOne can see this by looking at the output of this\r\ncat /proc/PID/environ |strings|grep --color LC_\r\n\r\nand what I see it this\r\nSUDO_COMMAND=/bin/sh -c echo BECOME-SUCCESS-pczarfgulenmjcrbairsyfcajgcpuvtt; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /u            sr/bin/python /tmp/ansible-tmp-1458818705.34-210547486321208/command\r\n\r\nI have tested this with Ansible 1.7.2 and there is no problem as it only sets LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 and not LC_ALL\r\n\r\nHow can you explain setting LC_ALL and why are you doing this?\r\nHow can this be disabled?\r\n\r\n##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### ANSIBLE VERSION\r\nansible 2.0.0\r\n\r\n##### CONFIGURATION\r\nN/A\r\n\r\n##### OS / ENVIRONMENT\r\nRHEL6.6\r\nLinux 2.6.32-504.3.3.el6.x86_64\r\n##### SUMMARY\r\n<!--- Explain the problem briefly -->\r\n\r\n##### STEPS TO REPRODUCE\r\nI run this example command to start my java process\r\nansible -o -i /my/hosts/file myhostname -m shell -a \"java -jar myfile.jar\" -b --become-user=remote_user --ask-become-pass -k\r\n\r\nThen you can verify the actual LC_\r\n##### EXPECTED RESULTS\r\nLC_ALL and other LC_* variables should NOT be altered\r\n\r\n##### ACTUAL RESULTS\r\nansible changes LC_* variables and test them to UTF-8"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/212605234","html_url":"https://github.com/ansible/ansible/issues/15138#issuecomment-212605234","issue_url":"https://api.github.com/repos/ansible/ansible/issues/15138","id":212605234,"user":{"login":"abadger","id":209242,"avatar_url":"https://avatars.githubusercontent.com/u/209242?v=3","gravatar_id":"","url":"https://api.github.com/users/abadger","html_url":"https://github.com/abadger","followers_url":"https://api.github.com/users/abadger/followers","following_url":"https://api.github.com/users/abadger/following{/other_user}","gists_url":"https://api.github.com/users/abadger/gists{/gist_id}","starred_url":"https://api.github.com/users/abadger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abadger/subscriptions","organizations_url":"https://api.github.com/users/abadger/orgs","repos_url":"https://api.github.com/users/abadger/repos","events_url":"https://api.github.com/users/abadger/events{/privacy}","received_events_url":"https://api.github.com/users/abadger/received_events","type":"User","site_admin":false},"created_at":"2016-04-20T21:04:05Z","updated_at":"2016-04-20T21:04:05Z","body":"Okay -- we discussed this at today's meeting and tentatively decided that setting LC_* and LANG at the global level aren't the right way to go about this.  We should set these variables inside specific modules when they do specific things (for instance, when we screenscrape the output of a command line tool).  This is, however, something that could be backwards compatible and also could reveal a lot of bugs in modules which have been expecting that we set these values globally rather than each module needing to do it individually.\r\n\r\nSo the plan is to make use of the config value to allow toggling between behaviours.  For 2.1.x we'll leave the value as it is for backwards compatibility.  Once 2.1.x branches from devel we'll switch the default to not set the LC_* and LANG vars and fix and fix modules that report problems because of that.  We'll evaluate before 2.1.x releases whether to leave the 2.1.x default no setting of the locales or turn it back on for backwards compatibility for another release.\r\n\r\nThanks everyone for input on this."}}