Basically I just added an ssh-agent job as well to my jobs, but as a last step, my ansible-playbook didn’t use the SSH_AUTH_SOCK.
It means it is failing when the playbook executed on the hosts. Important note, that managed instances are under a bastion host. SSH-key so agent-forwarding is mandatory.
The whole process works fine locally in a virtualized environment (vagrant / virtualbox):
# [root@ansible vagrant]# ssh-agent bash # [root@ansible vagrant]# ssh-add -L # The agent has no identities. # [root@ansible vagrant]# ssh-add /tmp/deploy.key # Identity added: /tmp/balico.key (/tmp/deploy.key) # [root@ansible vagrant]# ssh-add -L
playbook started after this action works like a chart. But not in CI environment.
Could you please help me out, how can I force ansible to use SSH_AUTH_SOCK to SSH in hosts in inventory?