Open timway opened 1 year ago
This appears to be an issue with ansible-runner
and not ansible-navigator
directly. I'll file an issue and potentially try to write a PR for it over there.
As a quick fix, I was able to work around this by setting my SSH_AUTH_SOCK
to the file vscode-ssh-auth-sock linked to. (eg, EXPORT SSH_AUTH_SOCKET=/tmp/ssh-xkYbL0MKH1/agent.14010
)
As a quick fix, I was able to work around this by setting my
SSH_AUTH_SOCK
to the file vscode-ssh-auth-sock linked to. (eg,EXPORT SSH_AUTH_SOCKET=/tmp/ssh-xkYbL0MKH1/agent.14010
)
@David-Igou, here's an alternative approach that doesn't require you to find out what the path is to your socket:
SSH_AUTH_SOCK=$( [[ -L "$SSH_AUTH_SOCK" ]] && readlink "$SSH_AUTH_SOCK" || echo "$SSH_AUTH_SOCK" ) ansible-navigator
I ended up setting an alias that included this approach so it didn't matter if I was ssh'ing directly into the host from a terminal or whether I was using VSCode Remote SSH. The above just checks to see if $SSH_AUTH_SOCK
is a symlink and uses readlink
to get the correct file path set if necessary.
Thanks @David-Igou and @snapp I appreciate the work-arounds. Thanks @ssbarnea for dropping it on the board for a longer term fix.
ISSUE TYPE
SUMMARY
Symbolic links are not followed when determining the volume mount paths for the SSH agent forwarding bits.
Running on Mac OS I add an SSH key with a passphrase into my SSH agent. Leveraging VS Code with the Remote-SSH plugin I forward the agent into remote host. This works fine, the remote host can run
ssh-add -l
and I see the key and am able tossh
into the managed node I want to use withansible-navigator
.The VS Code Remote-SSH plugin sets up
SSH_AUTH_SOCK
to point to a file within thetmpdir
configuration value in the plugin which seems to be/run/user/<uid-of-remote-host-user>
. It essentially just creates a symbolic link to the normal file where the forwarded agent is placed byssh
.ANSIBLE-NAVIGATOR VERSION
CONFIGURATION
LOG FILE
VS Code Remote-SSH Log
STEPS TO REPRODUCE
ssh-add -i ...
commandansible-navigator
(from the AAP 2.4 repos in my case)ansible-navigator exec bash
and inspect the SSH agent withssh-add -l
and notice it fails to connect.EXPECTED RESULTS
I'd expect the SSH agent is forwarded into the VM correctly.
ACTUAL RESULTS
It fails to connect to the SSH agent specified by
SSH_AUTH_SOCK
in the environment.ADDITIONAL INFORMATION
I know this is a bit of an esoteric configuration but I keep trying different ways to use SSH keys particularly ones protected by passphrases with
ansible-navigator
starting from Mac OS and am just continuously coming up empty.