diff --git a/plugins/modules/database/postgresql/postgresql_pg_hba.py b/plugins/modules/database/postgresql/postgresql_pg_hba.py index e8f52c1c44c..1f484bcfeab 100644 --- a/plugins/modules/database/postgresql/postgresql_pg_hba.py +++ b/plugins/modules/database/postgresql/postgresql_pg_hba.py @@ -335,7 +335,7 @@ def add_rule(self, rule): ekeys = set(list(oldrule.keys()) + list(rule.keys())) ekeys.remove('line') for k in ekeys: - if oldrule[k] != rule[k]: + if oldrule.get(k) != rule.get(k): raise PgHbaRuleChanged('{0} changes {1}'.format(rule, oldrule)) except PgHbaRuleChanged: self.rules[key] = rule