Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,9 @@
tags:
- postgres
- postgres-pgupgrades

- include: postgres-zabbix-grants.yml
when: postgres_monitoring is true
tags:
- postgres
- postgres_grant
24 changes: 24 additions & 0 deletions tasks/postgres-zabbix-grants.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
- name: Create list of grants
vars:
users_grants: "{{ item.1.grants }}"
set_fact:
all_users_grants: "{{ all_users_grants | default([]) + [users_grants] }}"
loop: "{{ q('subelements', postgres_clusters, 'users', {'skip_missing': True}) }}"
when: item.1.grants is defined

#- name: Show result
# debug:
# var: all_users_grants

- name: Add GRANTs for users
become: yes
become_user: postgres
postgresql_privs:
db: "{{ item.db }}"
privs: "{{ item.privs }}"
type: "{{ item.type }}"
objs: "{{ item.objs }}"
schema: "{{ item.schema }}"
role: "{{ item.role }}"
with_items: "{{ all_users_grants }}"