even if I set localhost connections to trust in pg_hba.conf on that exact server I get the same "unable to connect to database: fe_sendauth: no password supplied error from ansible
my current workaround is to got through shell and pg_ctl -D $PGDATA reload as the postgres user.
sorry, it took a while until I got the chance to dig into this a little deeper.
postgres via ansible - ERROR
> ansible -i ~/repos/ansible-inventory-eakte/ 'dbserver' -l rd5912 -m postgresql_query -a "login_unix_socket='/tmp' query='SHOW port'" --become --become-user postgres
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
[WARNING]: Database name has not been passed, used default database to connect to.
rd5912 | FAILED! => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"msg": "unable to connect to database: fe_sendauth: no password supplied\n"
}
Other targets in the same supposedly state work. Also these tests of connectivity to postgres on the server(s) that show the postgres via ansible issue are successful.
postgres via ssh - WORKS*
> ssh rd5912 'sudo -u postgres /opt/db/postgres/postgresql/bin/psql -qAtc "SHOW port ;"'
could not change directory to "/home/username": Permission denied
5432
nice guess, but I compared the folder with the binaries as well as the content of data_directory between a failing and a working host. The SELinux context is identical, so it’s apparently not that.