Last active
June 18, 2021 15:06
-
-
Save makmanalp/a95aa39f4b3171baeb5b to your computer and use it in GitHub Desktop.
SSH agent forwarding tester for ansible / vagrant
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
sudo: no | |
tasks: | |
- shell: echo "Client= [$SSH_CLIENT] Sock= [$SSH_AUTH_SOCK]" | |
register: myecho | |
- debug: msg="{{myecho.stdout}}" | |
- shell: ssh-add -l | |
register: myecho | |
- debug: msg="{{myecho.stdout}}" | |
- shell: ssh -T -vvvv [email protected] | |
register: myecho | |
- debug: msg="{{myecho.stdout}}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Still didn't work for me, after setting up the
-HE
flag andbecome: false
for the task that required the agent.For me setting an explicit
--ssh-extra-args '-o UserKnownHostsFile=/dev/null'
for the ansible-playbook invocation solved the issue. Thanks to this SO answer https://stackoverflow.com/a/23704069