Trying since hours, can’t make it work (although it worked already somewhen)…
OK.
Having a public ssh key, say ~/.ssh/id_rsa.pub. Configured it to Bitbucket. Able to checkout my project using public key authentication from bitbucket on my local machine.
Was going to try that on an ansible node using ssh-agent forwarding.
Oh, strange. Maybe I know why it works. I must have tried that earlier too.
On my node I tried to clone the project manually. Didn’t work of course. But on the way I was asked to add the bitbucket identity to the known hosts on my node.
The authenticity of host ‘bitbucket.org (104.192.141.1)’ can’t be established.
RSA key fingerprint is SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added ‘bitbucket.org,104.192.141.1’ (RSA) to the list of known hosts.
In the end the local clone didn’t work, but after that step the above sequence worked from my control node… So I was able to clone the project from remote after having bitbucket as known host on the node… Makes sense?
I think in order to make ssh-agent forwarding work with ansible (at least with bitbucket) one has to make sure the node knows about the public key of bitbucket beforehand.