postgres: fix defaults #75

Merged
erdnaxe merged 1 commit from postgres into master 2021-11-28 11:08:22 +01:00
3 changed files with 4 additions and 9 deletions
Showing only changes of commit fd0cb811a7 - Show all commits

View file

@ -1,5 +0,0 @@
---
postgresql_hosts: []
postgresql_databases: []
postgresql_users: []
...

View file

@ -55,7 +55,7 @@
lc_collate: en_US.UTF-8 lc_collate: en_US.UTF-8
lc_ctype: en_US.UTF-8 lc_ctype: en_US.UTF-8
template: template0 template: template0
loop: "{{ postgresql.databases }}" loop: "{{ postgresql.databases | default([]) }}"
- name: Create users - name: Create users
become: true become: true
@ -65,7 +65,7 @@
name: "{{ item.name }}" name: "{{ item.name }}"
password: "{{ item.password }}" password: "{{ item.password }}"
no_log: true no_log: true
loop: "{{ postgresql.users }}" loop: "{{ postgresql.users | default([]) }}"
- name: Grant privileges to users - name: Grant privileges to users
become: true become: true
@ -77,5 +77,5 @@
privs: "{{ item.privs | join(',') }}" privs: "{{ item.privs | join(',') }}"
obj: "{{ item.database }}" obj: "{{ item.database }}"
no_log: true no_log: true
loop: "{{ postgresql.users }}" loop: "{{ postgresql.users | default([]) }}"
... ...

View file

@ -2,6 +2,6 @@
# TYPE DATABASE USER ADDRESS METHOD # TYPE DATABASE USER ADDRESS METHOD
local all postgres peer map=map_local local all postgres peer map=map_local
{% for host in postgresql.hosts %} {% for host in postgresql.hosts | default([]) %}
host "{{ host.database }}" "{{ host.user }}" {{ host.net }} {{ host.method }} host "{{ host.database }}" "{{ host.user }}" {{ host.net }} {{ host.method }}
{% endfor %} {% endfor %}