xoxys.postgres/tasks/config.yml

34 lines
1.1 KiB
YAML
Raw Normal View History

2018-10-16 20:53:36 +02:00
---
- block:
2018-10-26 21:56:47 +02:00
- name: Setup global config file
template:
src: postgresql/data/postgresql.conf.j2
dest: "{{ __postgres_config_path }}/postgresql.conf"
mode: 0600
notify: __postgres_restart
2018-10-26 21:56:47 +02:00
- name: Create local users for pam auth
user:
name: "{{ item.name }}"
password: "{{ item.password | password_hash('sha512', 65534 | random(seed=inventory_hostname) | string) }}"
state: "{{ item.state | default('present') }}"
2019-08-27 22:55:28 +02:00
loop: "{{ postgres_users }}"
2018-10-26 21:56:47 +02:00
no_log: True
when: item.pam_user | default(False)
2018-10-22 22:10:06 +02:00
2018-10-26 21:56:47 +02:00
- name: Setup client authentication
template:
src: postgresql/data/pg_hba.conf.j2
dest: "{{ __postgres_config_path }}/pg_hba.conf"
mode: 0600
notify: __postgres_restart
- name: Open ports in iptables
iptables_raw:
name: allow_postgres_port
state: present
rules: '-A INPUT -m state --state NEW -p tcp --dport {{ postgres_connection_port }} -j ACCEPT'
2019-06-10 15:05:20 +02:00
when: postgres_iptables_enabled | bool
2018-10-16 20:53:36 +02:00
become: True
become_user: root