diff --git a/changelogs/fragments/887-rollback-if-nothing-changed.yml b/changelogs/fragments/887-rollback-if-nothing-changed.yml new file mode 100644 index 0000000000..7ae40ebb5a --- /dev/null +++ b/changelogs/fragments/887-rollback-if-nothing-changed.yml @@ -0,0 +1,2 @@ +bugfixes: +- postgresql_privs - rollback if nothing changed (https://github.com/ansible-collections/community.general/issues/885). diff --git a/plugins/modules/database/postgresql/postgresql_privs.py b/plugins/modules/database/postgresql/postgresql_privs.py index 30f2de7988..155bd87e94 100644 --- a/plugins/modules/database/postgresql/postgresql_privs.py +++ b/plugins/modules/database/postgresql/postgresql_privs.py @@ -1102,7 +1102,7 @@ def main(): conn.rollback() module.fail_json(msg=to_native(e.message)) - if module.check_mode: + if module.check_mode or not changed: conn.rollback() else: conn.commit()