Can't ping remote server(s) from non-root user

Hey,

So I am just getting started with Ansible, and have been able to ping a remote server with root access, but I am having trouble doing the same without root access. Running with verbose output I get:

ansible all --check -m ping -vvvv -i /usr/local/bin/ansible_comp/hosts_next_version

ESTABLISH CONNECTION FOR USER: joe

REMOTE_MODULE ping CHECKMODE=True

EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/joe/.ansible/cp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 server-1 /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1450036007.2-120481441078037 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1450036007.2-120481441078037 && echo $HOME/.ansible/tmp/ansible-tmp-1450036007.2-120481441078037’

PUT /var/folders/pt/ld9k57zd2qz4yf6h_7k3c24m0000gp/T/tmpSCboHh TO /home/deploy/.ansible/tmp/ansible-tmp-1450036006.88-248428083902840/ping

server-1 | FAILED => failed to transfer file to /home/deploy/.ansible/tmp/ansible-tmp-1450036006.88-227828078688673/ping:

Connection closed

If it was any command other than ping it seems obvious enough how to run as the sudo user, which I assume would fix the issue. With ping, I am not sure where to specify that i’d like to run as sudo. Or maybe the issue has nothing to do with sudo access?

Sincere thanks for any help!

It looks like the SFTP to put a file onto the remote server is failing.

Do you have anything in your profile on the remote side that may be echoing on login? I believe SFTP will have issues if that is the case.

Another option is to try setting scp_if_ssh = True in your ansible.cfg under the [ssh_connection] section.