From 06b54d5f8987840fac19526925c9f3cbd64c9083 Mon Sep 17 00:00:00 2001 From: Jeltz Date: Wed, 10 Mar 2021 14:27:14 +0100 Subject: [PATCH] Use postgresql_privs --- roles/postgresql_server/tasks/main.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 }}" ...