ansible locale issue

Hi experts,I report a bug on github, but I notice the maillist is a better way to ask my quesiton, so anyone can help me on below issue?
ANSIBLE VERSION

ansible 1.9.6
configured module search path = None

CONFIGURATION

/etc/ansible/ansible.cfg
[defaults]
forks = 100
inventory = /etc/ansible/hosts
pipelining = True
host_key_checking = False

/etc/ansible/hosts
[test1]
192.168.200.1
[test2]
192.168.200.2

OS / ENVIRONMENT

localhost CentOS Linux release 7.2.1511 (Core)
192.168.200.1 CentOS Linux release 7.2.1511 (Core)
192.168.200.2 CentOS Linux release 7.2.1511 (Core)
All system installed python 2.7.5

SUMMARY

One of the remote target can’t execute any ansible command, but no clear error log I can get

STEPS TO REPRODUCE

run ping moudle from localhost to 192.168.200.1 failed
run ping moudle from localhost to 192.168.200.2 success

EXPECTED RESULTS
 # ansible -vvvv test2 -m ping
<192.168.200.2> ESTABLISH CONNECTION FOR USER: root
<192.168.200.2> REMOTE_MODULE ping
<192.168.200.2> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/root/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 192.168.200.2 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1462592345.97-78459488561706 && echo $HOME/.ansible/tmp/ansible-tmp-1462592345.97-78459488561706'
<192.168.200.2> PUT /tmp/tmp5a6Mjm TO /root/.ansible/tmp/ansible-tmp-1462592345.97-78459488561706/ping
<192.168.200.2> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/root/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 192.168.200.2 /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1462592345.97-78459488561706/ping; rm -rf /root/.ansible/tmp/ansible-tmp-1462592345.97-78459488561706/ >/dev/null 2>&1'
192.168.200.2 | success >> {
    "changed": false,
    "ping": "pong"
}

or I should get the clear reason why ansible didn’t run successful on 192.168.200.1

ACTUAL RESULTS

ansible exec on test1 failed but no clear error log

# ansible -vvvv test1 -m ping
<192.168.200.1> ESTABLISH CONNECTION FOR USER: root
<192.168.200.1> REMOTE_MODULE ping
<192.168.200.1> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/root/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 192.168.200.1 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1462592317.55-110943377524448 && echo $HOME/.ansible/tmp/ansible-tmp-1462592317.55-110943377524448'
/root/.ansible/tmp/ansible-tmp-1462592317.55-110943377524448/ping
<192.168.200.1> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/root/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 192.168.200.1 /bin/sh -c 'LANG=en_US.UTF-8 LC/root/.ansible/tmp/ansible-tmp-1462592317.55-110943377524448/ >/dev/null 2>&1'
192.168.200.1 | FAILED >> {
    "failed": true,
    "msg": "\u001b[?25h\u001b[0G\u001b[K\u001b[?25h\u001b[0G\u001b[K/usr/bin/python: can't open file '\u001b[?25h\u001b[0G\u001b[K\u001b[?25h\u001b[0G\u001b[K/root/.ansible/tmp/ansible-tmp-1462592317.55-110943377524448/ping': [Errno 2] No such file or directory\r\nOpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 56: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 10758\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to 192.168.200.1 closed.\r\n",
    "parsed": false
}

 # ansible -vvvv test2 -m ping
<192.168.200.2> ESTABLISH CONNECTION FOR USER: root
<192.168.200.2> REMOTE_MODULE ping
<192.168.200.2> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/root/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 192.168.200.2 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1462592345.97-78459488561706 && echo $HOME/.ansible/tmp/ansible-tmp-1462592345.97-78459488561706'
<192.168.200.2> PUT /tmp/tmp5a6Mjm TO /root/.ansible/tmp/ansible-tmp-1462592345.97-78459488561706/ping
<192.168.200.2> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/root/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 192.168.200.2 /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1462592345.97-78459488561706/ping; rm -rf /root/.ansible/tmp/ansible-tmp-1462592345.97-78459488561706/ >/dev/null 2>&1'
192.168.200.2 | success >> {
    "changed": false,
    "ping": "pong"
}

And on 192.168.200.1, one ansible process running all the time:

root     13492  0.0  0.0  76404  1632 ?        Ss   11:50   0:00 ssh: /root/.ansible/cp/ansible-ssh-192.168.200.1-22-root [mux]

A lot of dir keep generating under /root/.ansible/tmp/

[root@sh1 ~]# ll  /root/.ansible/tmp/ | wc -l
864

And the content of every dir is empty

[root@sh1 ~]# ls -lh /root/.ansible/tmp/ansible-tmp-1462595658.2-267442571738160/
total 0

I notice the test1 node didn’t reply the right path, it reply the path:
\u001b[?25h\u001b[0G\u001b[K\u001b[?25h\u001b[0G\u001b[K/root/.ansible/tmp/ansible-tmp-1462609576.78-140384241971167/ping

So I think this must be a locate issue, but the management node and test1 node has been set to:

LANG=en_US.UTF-8
LC_CTYPE=“en_US.UTF-8”
LC_NUMERIC=“en_US.UTF-8”
LC_TIME=“en_US.UTF-8”
LC_COLLATE=“en_US.UTF-8”
LC_MONETARY=“en_US.UTF-8”
LC_MESSAGES=“en_US.UTF-8”
LC_PAPER=“en_US.UTF-8”
LC_NAME=“en_US.UTF-8”
LC_ADDRESS=“en_US.UTF-8”
LC_TELEPHONE=“en_US.UTF-8”
LC_MEASUREMENT=“en_US.UTF-8”
LC_IDENTIFICATION=“en_US.UTF-8”
LC_ALL=

So any idea?

在 2016年5月7日星期六 UTC+8下午4:21:56,Andy写道:

HI
can you remove “pipelining = True” from the config and test ?

Your problem is that you likely have something in .bashrc that is spewing ascii escape codes.

Thanks a lot ! Matt! After clean host test1 .bashrc, this issue gone away!
I will dig out where is wrong in the .bashrc.

在 2016年5月7日星期六 UTC+8下午8:32:43,Matt Martz写道:

This issue caused by nvm, after install nvm , it generate two configs in .bashrc:

export NVM_DIR=“/root/.nvm”
[ -s “$NVM_DIR/nvm.sh” ] && . “$NVM_DIR/nvm.sh” # This loads nvm

These configs will lead ansible failed, does this an ansible bug? It will conflict with nvm.