diff --git a/handlers/main.yml b/handlers/main.yml index f75b6f4..85b455e 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -2,3 +2,6 @@ - name: Reload PostgreSQL service: name={{ postgresql_service_name }} state=reloaded + +- name: Restart PostgreSQL + service: name={{ postgresql_service_name }} state=restarted diff --git a/tasks/main.yml b/tasks/main.yml index 57690b7..4ea0c73 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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 diff --git a/templates/pg_hba.conf.debian.j2 b/templates/pg_hba.conf.debian.j2 index e758617..eb30db0 100644 --- a/templates/pg_hba.conf.debian.j2 +++ b/templates/pg_hba.conf.debian.j2 @@ -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 @@ -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 %} diff --git a/templates/pg_hba.conf.redhat.j2 b/templates/pg_hba.conf.redhat.j2 index fa3ae20..6381a9b 100644 --- a/templates/pg_hba.conf.redhat.j2 +++ b/templates/pg_hba.conf.redhat.j2 @@ -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 @@ -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 %}