Initial commit

This commit is contained in:
nd 2018-09-13 18:57:12 +02:00
commit c611a53558
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9
4 changed files with 25 additions and 0 deletions

2
defaults/main.yml Normal file
View file

@ -0,0 +1,2 @@
postgresql:
allowed_hosts: []

2
handlers/main.yml Normal file
View file

@ -0,0 +1,2 @@
- name: restart postgres
service: name=postgresql state=restarted

13
tasks/main.yml Normal file
View file

@ -0,0 +1,13 @@
- name: install postgres
apt:
pkg: postgresql
- name: generate pg_hba
template:
src: pg_hba.conf.j2
dest: /etc/postgresql/9.6/main/pg_hba.conf
owner: postgres
group: postgres
mode: 0640
notify:
- restart postgres

8
templates/pg_hba.conf.j2 Normal file
View file

@ -0,0 +1,8 @@
{% for item in postgresql.allowed_hosts %}
{{ item.type | default('host') }} {{ item.database | default('all') }} {{ item.user | default('all') }} {{ item.auth | default('md5') }}
{% endfor %}
local all postgres peer
local all all peer
host all all 127.0.0.1/32 md5
host all all ::1/128 md5