Initial commit
This commit is contained in:
commit
c611a53558
4 changed files with 25 additions and 0 deletions
2
defaults/main.yml
Normal file
2
defaults/main.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
postgresql:
|
||||
allowed_hosts: []
|
||||
2
handlers/main.yml
Normal file
2
handlers/main.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
- name: restart postgres
|
||||
service: name=postgresql state=restarted
|
||||
13
tasks/main.yml
Normal file
13
tasks/main.yml
Normal 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
8
templates/pg_hba.conf.j2
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue