$ ansible -i test all -m ping -u root -vvvvv -c paramiko
<10.10.0.242> ESTABLISH CONNECTION FOR USER: root on PORT 22 TO 10.10.0.242
<10.10.0.242> REMOTE_MODULE ping
<10.10.0.242> EXEC /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1452643204.88-178243528154466 && echo $HOME/.ansible/tmp/ansible-tmp-1452643204.88-178243528154466’
<10.10.0.242> PUT /var/folders/1d/nqrbvtz120nb7r2rjqzpvs7m0000gn/T/tmpqHPWsg TO /home/root/.ansible/tmp/ansible-tmp-1452643204.88-178243528154466/ping
<10.10.0.242> EXEC /bin/sh -c ‘LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/root/.ansible/tmp/ansible-tmp-1452643204.88-178243528154466/ping; rm -rf /home/root/.ansible/tmp/ansible-tmp-1452643204.88-178243528154466/ >/dev/null 2>&1’
10.10.0.242 | success >> {
“changed”: false,
“ping”: “pong”
}
Any idea what the culprit might be? At first glance the only real difference I can see is that the older version had /bin/sh -c in front, but that could just be a change in logging.
Looks like your shell is injecting control characters into the output
stream. (the initial junk is a terminal control code sequence:
ESC[?1034h ). We'll probably need information about the shell you're
using on the remote machine and its configuration.
On the remote hosts we are using the fish shell instead of bash or others and that seems to be the root of the problem. When changing to bash as the login shell, Ansible would work just fine, but that’s not really an option.
I’ll check out the github issue, but I just wanted to post back here.
I narrowed down the issue to being related to the local TERM environment variable (xterm-256color). Because my local terminal was consuming the garbage characters when I was running the ping command remotely, the only way to see the escape characters is to redirect to a file &> out and you’ll see them there (it took a moment to realize what was going on because originally I was just running the python ping command by hand and I wasn’t seeing the starting escape characters).
If you plaster TERM=vt100 in front of any of your ansible commands things work great and the ping command works.
Another interesting thing to note is that if you enable pipelining=true in your ansible.cfg, you don’t need TERM=vt100 to be set.
I didn’t think sending my local term was intended - I was able to track down the issue in the paramiko code (it calls os.sys to get the local term) but I couldn’t find the corresponding openssh issue.