I've used the Ansible Galaxy role geerlingguy.postgresql[1] to create a PostgreSQL server. But I'm a bit stuck onto how I can create a user in PostgreSQL which has the following rights:
How can I achieve this?
My config at the moment looks like this:
postgresql_databases:
- name: mydb
owner: myuser
postgresql_users:
- name: myuser
db: mydb
objs: ALL_IN_SCHEMA
privs: SELECT,INSERT,UPDATE,DELETE,CONNECT,CREATEDB
role_attr_flags: CREATEROLE
Uh, postgres permission model is a mess (... not a mess, just is more complicated than everyone would like it to be).
You need to configure FOUR separate things for user to have an access (not counting the creation of the user itself and configuring hg_hba.conf
for network-level access):
Moreover, when you do this, you need to have admin access to postgress, and it should not be root (it should be 'postgres' user for most Postgres installations).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.