ansible -vvvv 172.30.129.174 -m raw -a "show switch”
<172.30.129.174> ESTABLISH CONNECTION FOR USER: james
<172.30.129.174> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/james
/.ansible/cp/ansible-ssh-%h-%p-%r” -o IdentityFile=“/Users/james/.ssh/id_rsa” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=james -o ConnectTimeout=10 172.30.129.174 show switch
sw_b2-1 | FAILED => SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh
Does anyone have any ideas why I can’t get private keys to work?
Am I missing a flag or setting? I’ve got “ansible_ssh_private_key_file” set to the full path to my id_rsa file. Is that all it takes to get Ansible to use private keys?
this is probably a control persist issue, try disabling those options
(empty ssh_args in ansible.cfg) and see if that also fixes the
problem.
if so, you can switch to paramiko (its faster than ssh w/o control
persist) or play with the timeout settings (default 60s). In some
cases it has to do with older Openssh versions not behaving well or
using different ssh server software.