diff --git a/roles/postgresql_server/tasks/main.yml b/roles/postgresql_server/tasks/main.yml index 6be936f..0dc5c1c 100644 --- a/roles/postgresql_server/tasks/main.yml +++ b/roles/postgresql_server/tasks/main.yml @@ -57,7 +57,17 @@ db: "{{ item.database }}" name: "{{ item.name }}" password: "{{ item.password }}" - priv: "{{ item.priv }}" no_log: true loop: "{{ postgresql_users }}" + +- name: Grant privileges to users + become: true + become_user: postgres + postgresql_privs: + db: postgres + type: database + role: "{{ item.name }}" + privs: "{{ item.privs | join(',') }}" + obj: "{{ item.database }}" + loop: "{{ postgresql_users }}" ...