Connect to remote servers

Hi all,

I need to configure an instance which needs to connect to a remote server via ssh, I’ve been doing some tests and troubleshooting but I’m doing something wrong I guess, since when I’m tryin to connect to that ssh server, the connection gets stuck

A (ansible) → B (new server) -ssh> C (remote server)

On ansible I see my key has been forwarded:

$ ssh-add -l 2048 XXX Users/sisu/.ssh/id_rsa(RSA)

allowing forwarding on ansible:

$ grep args ansible.cfg ssh_args = "-o ForwardAgent=yes"

Task:

I found my problem.

As I was running ansible with sudo (-s) parameter, my ssh-agent socket was forwarded for the regular user only. Then I need to add “sudo: yes” to all the tasks I need sudo and be sure the task where I run ssh to remote tasks has no sudo.

This link helped me to find the problem: https://github.com/ansible/ansible/issues/7235

Thanks