community.postgresql 4.2.0 Released - Whats New and How to Test

Introduction

community.postgresql is the Ansible Collection that provides modules and plugins to manage PostgreSQL databases, roles, privileges, extensions, and configuration through Ansible playbooks. It is one of the collections bundled in the ansible community package and is commonly used to automate PostgreSQL database provisioning and administration.

Version 4.2.0 has been published to Ansible Galaxy. This is a minor release that adds one new privilege-related feature for PostgreSQL 17 and fixes three bugs in the postgresql_db module.

Whats New

Minor Changes

Bugfixes

Affected Components

ComponentTypeChange
postgresql_privsModuleAdds support for MAINTAIN privilege (PostgreSQL 17)
postgresql_dbModuleFixes connection limit handling for value "0"
postgresql_dbModuleFixes session_role being ignored on raw connections
postgresql_dbModuleFixes double execution when restoring .sql files

How to Install and Test

Install or upgrade the collection from Ansible Galaxy:

ansible-galaxy collection install community.postgresql --upgrade

ansible-galaxy collection list community.postgresql

ansible-doc postgresql_privs -s
ansible-doc postgresql_db -s

To confirm the exact version installed and pin it explicitly in a requirements.yml file:

cat > requirements.yml << 'EOF'
collections:
  - name: community.postgresql
    version: 4.2.0
EOF

ansible-galaxy collection install -r requirements.yml

Users relying on the MAINTAIN privilege support should verify the target PostgreSQL server is version 17 or later, since this privilege does not exist on older PostgreSQL versions. Users who restore databases from .sql files with postgresql_db should re-test their state: restore tasks against version 4.2.0 to confirm the file is no longer executed twice.