I have a playbook where I am trying to clone from a private repo (GIT) to a server.
I have setup ssh forwarding and when I ssh into the server and try to manually clone
By reading the documentation for ssh forwarding in ansible. I was able to figure out the solution.
The problem was that my ssh keys were not being forwarded because Ansible does not by default forward your keys, even if you have set up the key forwarding on ~/.ssh/conf
(I updated my question with the ansible.cfg
that I had before fixing the issue).
The solution is was to add transport = ssh
to ansible.cfg
under [defaults]
plus running ansible-playbook
from the location where ansible.cfg
is located and make sure thet the following setting exists in the /etc/ssh/sshd_config
of the target box:
AllowAgentForwarding yes
My ansible.cfg
now looks like this:
[defaults]
transport = ssh
[ssh_connection]
ssh_args = -o ForwardAgent=yes