Ansible ssh-agent check

Hi,

I’m using the ssh-agent in order to make Ansible aware of my identity during the setup. Unfortunately I mostly forget to run

“ssh-add ~/.ssh/id_rsa”

before starting lengthy installations, so at some point later for instance a “git clone” fails because auf authentication problems.

Is there a chance to run “ssh-add -l” locally before running the full installation in order to see, if the ssh agent is properly configured?

  • name: Configure SSH agent
    delegate_to: localhost
    shell: |
    ssh-add ~/.ssh/id_rsa

Thanks