.bashrc io to stdout interferes with ansible and ansible-playbook commands

Long story short: I was building out a system wherein the hadoop user’s .bashrc file was writing to stdout. This interfered with the functioning of the ansible and ansible-playbook commands. For instance:

» ansible -u hadoop --private-key=/home/drc/.ssh/obsidianaws.pem -i /home/drc/.ansible/hosts -m ping box1

box1 | FAILED => failed to open a SFTP connection

» ansible -u hadoop -c ssh --private-key=/home/drc/.ssh/obsidianaws.pem -i /home/drc/.ansible/hosts -m ping box1
box1 | FAILED => failed to transfer file to /home/hadoop/.ansible/tmp/ansible-1362080597.37-11062316293652/ping:
Received message too long 173490514

The hadoop account had no obvious ssh or authentication issues. It could shell into the box, issue commands, etc.

Removing hadoop’s bashrc file cleared up the problem. As a further test I created a single line .bashrc that just echoed text:
echo “hello from .bashrc”

This sufficed to reproduce the problem illustrated above.

I think there was a post about this earlier, and I was asking for a
github ticket about it, and I got another post.

I'll file one :slight_smile:

Ok filed here, this is an easy fix.

https://github.com/ansible/ansible/issues/2268

I am finding this both hard to believe and hilarious. I did not get much sleep last night, but even so I cannot understand how I thought I was on github and instead was on google groups. Too many browser tabs open, too little awareness. Nature’s way telling me to go to sleep…

Thanks, Michael.

drcabana@gmail.com wrote:

Long story short: I was building out a system wherein the hadoop user's
.bashrc file was writing to stdout. This interfered with the functioning
of the ansible and ansible-playbook commands. For instance:

.bashrc is executed for scripts and non-interactive commands. This is
something that belongs in .bash_profile, otherwise you are going to be
messing up a whole slew of things, including scp/sftp.

Daniel