fix: pg_hba when multiple users or multiple databases
This commit is contained in:
parent
44ac805f2c
commit
7b4e1b63f4
4 changed files with 6 additions and 4 deletions
|
@ -13,6 +13,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- fix replication database in pg_hba
|
- fix replication database in pg_hba
|
||||||
|
- fix pg_hba when multiple users or multiple databases
|
||||||
|
|
||||||
## v1.0.0 - 2021-09-10
|
## v1.0.0 - 2021-09-10
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
- name: Converge
|
- name: Converge
|
||||||
hosts: all
|
hosts: all
|
||||||
roles:
|
roles:
|
||||||
- ansible-role-postgresql
|
- postgresql
|
||||||
vars:
|
vars:
|
||||||
postgresql_use_official_repository: true
|
postgresql_use_official_repository: true
|
||||||
postgresql_primary: true
|
postgresql_primary: true
|
||||||
|
@ -12,11 +12,13 @@
|
||||||
- type: hostssl
|
- type: hostssl
|
||||||
databases:
|
databases:
|
||||||
- myappli
|
- myappli
|
||||||
|
- myappli2
|
||||||
users: all
|
users: all
|
||||||
subnet: samenet
|
subnet: samenet
|
||||||
method: md5
|
method: md5
|
||||||
postgresql_databases:
|
postgresql_databases:
|
||||||
- name: myappli
|
- name: myappli
|
||||||
|
- name: myappli2
|
||||||
postgresql_users:
|
postgresql_users:
|
||||||
- name: myuser
|
- name: myuser
|
||||||
database: myappli
|
database: myappli
|
||||||
|
|
|
@ -21,8 +21,7 @@ def test_hba_file(host):
|
||||||
assert path.user == 'root'
|
assert path.user == 'root'
|
||||||
assert path.group == 'root'
|
assert path.group == 'root'
|
||||||
assert path.mode == 0o644
|
assert path.mode == 0o644
|
||||||
assert path.contains('hostssl "myappli" all samenet md5')
|
assert path.contains('hostssl "myappli","myappli2" all samenet md5')
|
||||||
|
|
||||||
|
|
||||||
def test_service(host):
|
def test_service(host):
|
||||||
service = host.service('postgresql@13-main')
|
service = host.service('postgresql@13-main')
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
local all postgres peer
|
local all postgres peer
|
||||||
{% for conn in postgresql_hba %}
|
{% for conn in postgresql_hba %}
|
||||||
{{ conn.type }} {% if conn.databases in ['all', 'replication'] %}{{ conn.databases }}{% else %}"{{ conn.databases|join('",') }}"{% endif %} {% if conn.users == 'all' %}all{% else %}"{{ conn.users|join('",') }}"{% endif %}{% if conn.type != 'local' %} {{ conn.subnet }}{%endif %} {{ conn.method }}
|
{{ conn.type }} {% if conn.databases in ['all', 'replication'] %}{{ conn.databases }}{% else %}"{{ conn.databases|join('","') }}"{% endif %} {% if conn.users == 'all' %}all{% else %}"{{ conn.users|join('","') }}"{% endif %}{% if conn.type != 'local' %} {{ conn.subnet }}{%endif %} {{ conn.method }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Reference in a new issue