The documentation for the postgresql_user module on how privileges for a user should be defined conflicts with itself regarding the format. The format is described as such in the options table:
priv | PostgreSQL privileges string in the format: table:priv1,priv2
However, the examples given below use another format
priv: "CONNECT/products:ALL"
priv: "ALL/products:ALL"
# Example privileges string format
INSERT,UPDATE/table:SELECT/anothertable:ALL
The blog post Ansible Loves PostgreSQL mentions yet another format:
priv: Privileges in “priv1/priv2” or table privileges in “table:priv1,priv2,…” format
I'm having trouble creating users with read-only access, i.e. SELECT privilege on all tables.
Could someone shed some light on the correct format to use, exemplified by giving a user read-only access on all tables?
Completely agree. See here too:
https://github.com/ansible/ansible-modules-core/blob/devel/database/postgresql/postgresql_user.py#L201
Permissions for database must be in that list. I was trying to specify table perms for database.