Created
January 2, 2015 11:43
-
-
Save jkbrzt/74d77a05be750024d88d to your computer and use it in GitHub Desktop.
Ansible task to verify that it's possible to login to github.com via SSH using forward agent
This file contains 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
- name: Verify GitHub SSH login | |
tags: | |
- debug | |
- deploy | |
shell: | | |
ssh_output=$(ssh -T [email protected] &>/dev/stdout) | |
echo | |
echo Should not be empty: | |
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" | |
echo | |
echo "ssh [email protected] => $ssh_output" | |
echo | |
if ! grep -q "successfully authenticated" <<< "$ssh_output"; then | |
echo | |
echo !!!GitHub error: SSH login failed!!! | |
echo Make sure your GitHub account public key authentication is working, | |
echo and that SSH agent forwarding is configured on your system. | |
echo https://developer.github.com/guides/using-ssh-agent-forwarding/ | |
echo | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment