vm-ansible/roles/postgresql/tasks/main.yaml

38 lines
774 B
YAML

---
- name: "Install PostgreSQL via apt"
apt:
update_cache: yes
state: present
name:
- postgresql
- name: Add access to every host on local network
postgresql_pg_hba:
dest: /var/lib/postgres/data/pg_hba.conf
contype: host
users: all
databases: all
address: samenet
state: present
- name: Add access to every host via tls on local network
postgresql_pg_hba:
dest: /var/lib/postgres/data/pg_hba.conf
contype: hostssl
users: all
databases: all
address: samenet
state: present
- name: Enable and restart PostgreSQL daemon
service:
name: postgresql
state: restarted
enabled: yes
- name: Allow postgresql port via ufw
community.general.ufw:
rule: allow
port: "5432"
proto: tcp