Skip to content

Allow authentication of non-system database users #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

- name: Reload PostgreSQL
service: name={{ postgresql_service_name }} state=reloaded

- name: Restart PostgreSQL
service: name={{ postgresql_service_name }} state=restarted
2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

- name: Install pg_hba.conf
template: src=pg_hba.conf.{{ ansible_os_family | lower }}.j2 dest={{ postgresql_conf_dir }}/pg_hba.conf owner=postgres group=postgres mode=0400 backup=yes
notify: Reload PostgreSQL
notify: Restart PostgreSQL

- include: backup.yml
when: postgresql_backup_dir is defined
Expand Down
14 changes: 8 additions & 6 deletions templates/pg_hba.conf.debian.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
local all postgres peer
{% endif %}

# Entries configured in postgresql_pg_hba_conf follow
{% if postgresql_pg_hba_conf is defined %}
{% for line in postgresql_pg_hba_conf %}
{{ line }}
{% endfor %}
{% endif %}

# End entries configured in postgresql_pg_hba_conf follow
{% if postgresql_pg_hba_local_socket is not defined or postgresql_pg_hba_local_socket %}
# "local" is for Unix domain socket connections only
local all all peer
Expand All @@ -26,9 +34,3 @@ host all all 127.0.0.1/32 md5
host all all ::1/128 md5
{% endif %}

# Entries configured in postgresql_pg_hba_conf follow
{% if postgresql_pg_hba_conf is defined %}
{% for line in postgresql_pg_hba_conf %}
{{ line }}
{% endfor %}
{% endif %}
14 changes: 8 additions & 6 deletions templates/pg_hba.conf.redhat.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
## This file is maintained by Ansible - CHANGES WILL BE OVERWRITTEN
##

# Entries configured in postgresql_pg_hba_conf follow
{% if postgresql_pg_hba_conf is defined %}
{% for line in postgresql_pg_hba_conf %}
{{ line }}
{% endfor %}
{% endif %}

# End entries configured in postgresql_pg_hba_conf follow
{% if postgresql_pg_hba_local_socket is not defined or postgresql_pg_hba_local_socket %}
# "local" is for Unix domain socket connections only
local all all peer
Expand All @@ -15,9 +23,3 @@ host all all 127.0.0.1/32 ident
host all all ::1/128 ident
{% endif %}

# Entries configured in postgresql_pg_hba_conf follow
{% if postgresql_pg_hba_conf is defined %}
{% for line in postgresql_pg_hba_conf %}
{{ line }}
{% endfor %}
{% endif %}