I seem to be having a problem where Ansible isn't using my SSH agent cache. I've run the following:
eval `ssh-agent`
ssh-add /tmp/key
Then I successfully log into one of the hosts from my inventory just fine:
ssh -i /tmp/key [email protected]
When using ansible on my Windows machine within WSL, the following ends with a weird single-line, triple ask (one for each in my inventory)
ansible --key-file /tmp/key -i ./hosts all -m ping
Output:
Enter passphrase for key '/tmp/key': Enter passphrase for key '/tmp/key': Enter passphrase for key '/tmp/key':
repo | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).",
"unreachable": true
}
follower | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).",
"unreachable": true
}
leader | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).",
"unreachable": true
}
I believe Ansible should be using Paramiko for SSH but I assume it would talk with my SSH agent anyway. Any guesses why this isn't working?
This is also running on WSL on Windows 10 if that matters.
Here is the output with "-vvv":
ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile="/tmp/key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/mnt/c/Users/me/.ansible/cp/58691c2f88 1.2.3.4 '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
This times out when run from the command line