This is an interesting question to read but something I learned today and was unable to find here is that peer authentication expects that:
A. the user is logged into the operating system as the database user B. any interactions with the database occur from within that OS user context
For example using Ansible, this requires tasks to be executed with:
become_user: postgres
or whatever user you're using to access your database. This will ensure your tasks logs in as the 'become_user' and then connects to the database server.
Looking at some of the answers, changing the authentication method to md5 allows normal password authentication for the database user and thus does not require database interactions to occur from within the context of a user logged into the OS. This will then allow you to specify host, username and password to login to PostgreSQL.
Changing the authentication method to trust seems very dangerous. Sure it will work but you will need to be absolutely sure that anyone meeting the connection criteria is trustworthy.