Hi This isn't an ansible problem. Take a look at some general SSH public key authentication pages, for instance:
https://www.digitalocean.com/community/tutorials/how-to-configure-ssh-key-based-authentication-on-a-linux-server