Issue 56430 (#57147)

* Adding integration test for 127.0.0.1/32 and ::1/128.

* Making sure file is not corrupted when render fails

* Fixes #56430

* Adding changelog for MR 57147/Issue 56430
This commit is contained in:
Sebastiaan Mannem 2019-05-31 12:32:29 +02:00 committed by Dag Wieers
commit 223f509ea3
4 changed files with 131 additions and 80 deletions

View file

@ -10,7 +10,7 @@
source: '0000:ffff::'
netmask: 'ffff:fff0::'
method: md5
backup: true
backup: 'True'
order: sud
state: "{{item}}"
check_mode: yes
@ -28,7 +28,7 @@
contype: "{{item.contype|default('host')}}"
databases: "{{item.databases|default('all')}}"
dest: /tmp/pg_hba.conf
method: md5
method: "{{item.method|default('md5')}}"
netmask: "{{item.netmask|default('')}}"
order: sud
source: "{{item.source|default('')}}"
@ -44,12 +44,12 @@
- name: Add several ip addresses
postgresql_pg_hba:
backup: true
backup: 'True'
contype: "{{item.contype|default('host')}}"
create: true
create: 'True'
databases: "{{item.databases|default('all')}}"
dest: /tmp/pg_hba.conf
method: md5
method: "{{item.method|default('md5')}}"
netmask: "{{item.netmask|default('')}}"
order: sud
source: "{{item.source|default('')}}"
@ -68,7 +68,7 @@
contype: "{{item.contype|default('host')}}"
databases: "{{item.databases|default('all')}}"
dest: /tmp/pg_hba.conf
method: md5
method: "{{item.method|default('md5')}}"
netmask: "{{item.netmask|default('')}}"
order: sud
source: "{{item.source|default('')}}"
@ -84,7 +84,7 @@
- name: Add new ip address for backup check and netmask_sameas_prefix check
postgresql_pg_hba:
backup: true
backup: 'True'
contype: host
dest: /tmp/pg_hba.conf
method: md5
@ -96,7 +96,7 @@
- name: Add new ip address for netmask_sameas_prefix check
postgresql_pg_hba:
backup: true
backup: 'True'
contype: host
dest: /tmp/pg_hba.conf
method: md5
@ -122,17 +122,22 @@
register: pg_hba_fail_src_all_with_netmask
ignore_errors: yes
- debug:
var: pg_hba.pg_hba
- assert:
that:
- 'pg_hba.pg_hba == [
{ "db": "all", "method": "md5", "type": "local", "usr": "all" },
{ "db": "all", "method": "md5", "type": "local", "usr": "postgres" },
{ "db": "all", "method": "md5", "src": "0:ff00::/120", "type": "host", "usr": "all" },
{ "db": "all", "method": "md5", "src": "192.168.0.0/24", "type": "host", "usr": "all" },
{ "db": "all", "method": "md5", "type": "local", "usr": "all" },
{ "db": "all", "method": "md5", "src": "127.0.0.1/32", "type": "host", "usr": "all" },
{ "db": "all", "method": "md5", "src": "::1/128", "type": "host", "usr": "all" },
{ "db": "all", "method": "scram-sha-256", "src": "0:ff00::/120", "type": "host", "usr": "all" },
{ "db": "replication", "method": "md5", "src": "192.168.0.0/24", "type": "host", "usr": "all" },
{ "db": "all", "method": "md5", "src": "172.16.0.0/16", "type": "host", "usr": "all" },
{ "db": "all", "method": "md5", "src": "192.168.0.0/24", "type": "host", "usr": "all" },
{ "db": "all", "method": "reject", "src": "192.168.1.0/24", "type": "host", "usr": "all" },
{ "db": "all", "method": "trust", "src": "172.16.0.0/16", "type": "host", "usr": "all" },
{ "db": "all", "method": "md5", "src": "0:fff0::/28", "type": "host", "usr": "all" }
]'
]'
- 'pg_hba_change is changed'
- 'pg_hba_checkmode_check.stat.exists == false'
- 'not pg_hba_idempotency_check1 is changed'