Skip to content

Commit

Permalink
configure hba rules separately
Browse files Browse the repository at this point in the history
  • Loading branch information
shtlrs committed May 16, 2024
1 parent 77c98f4 commit f7f5e4d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ansible/roles/postgres/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
insertafter: "# Put your actual configuration here"
marker: "# {mark} ANSIBLE MANAGED HBA CONF BLOCK"
block: |
{% for db in postgres_databases %}
host {{ db.name }} {{ db.owner }} all scram-sha-256
{% for rule in postgres_hba_rules %}
{{ rule.conn_type }} {{ rule.database }} {{ rule.user }} {{ rule.address }} {{ rule.method }}
{% endfor %}
loop: "{{ postgres_databases }}"
loop: "{{ postgres_hba_rules }}"
notify:
- Reload the postgres service
tags:
Expand Down
14 changes: 14 additions & 0 deletions ansible/roles/postgres/vars/main/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ postgres_users:
- pg_read_all_data


postgres_hba_rules:
- conn_type: host
database: pinnwand
user: pinnwand
address: all
method: scram-sha-256

- conn_type: host
database: all
user: blackbox
address: all
method: scram-sha-256


postgres_databases:
- name: pinnwand
owner: pinnwand

0 comments on commit f7f5e4d

Please sign in to comment.