Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b05245e
Replace anxs by ANXS in meta/main.yml
MrMegaNova May 28, 2024
a389942
Revert "Replace anxs by ANXS in meta/main.yml"
MrMegaNova May 28, 2024
915a9ea
drop Python 2 support
conscribtor Jun 30, 2024
bd5b91f
remove unsupported PostgreSQL configuration templates and test variables
conscribtor Jun 30, 2024
ea07fb7
require Ansible version 9
conscribtor Jun 30, 2024
525cd93
drop vars for EOL OSs
conscribtor Jul 5, 2024
8004fd5
update galaxy info with compatible OSs
conscribtor Jul 5, 2024
1bc1823
update Molecule README
conscribtor Jul 5, 2024
ed0719a
update compatibility matrix states
conscribtor Jul 6, 2024
176b474
Merge pull request #578 from conscribtor/drop-unsupported-dependencie…
MrMegaNova Jul 19, 2024
d99c9d6
Merge pull request #580 from ANXS/development
MrMegaNova Jul 19, 2024
625a21f
PG17 configuration
tsoulabail Jan 5, 2025
8985518
Update ansible to current
MrMegaNova Jan 6, 2025
05f51b6
Temporarly disable Rocky testing
MrMegaNova Jan 8, 2025
387320b
Merge pull request #587 from MrMegaNova/master
MrMegaNova Jan 8, 2025
c7da166
Merge pull request #588 from ANXS/development
MrMegaNova Jan 10, 2025
8003986
PG17 correction coquille
tsoulabail Jan 12, 2025
70ab43a
PG17 correction coquilles
tsoulabail Jan 12, 2025
128e6b7
corrections yamllint
tsoulabail Jan 19, 2025
3da8097
Merge pull request #590 from tsoulabail/PG17
jgo3364 Mar 17, 2025
c852b3c
update README to support pg17
jgo3364 Mar 17, 2025
bb57ec7
Merge pull request #592 from ANXS/development
jgo3364 Mar 17, 2025
6d0627a
temporary change anxs to ANXS to upload pg17 on galaxy
MrMegaNova Mar 17, 2025
b38e897
Revert "temporary change anxs to ANXS to upload pg17 on galaxy"
MrMegaNova Mar 17, 2025
bdccead
Fix deprecated ansible, fix CI, Remove Ubuntu 20.04
pulse-mind Nov 6, 2025
3a246b1
Remove ubuntu 20 and postgresql 12
pulse-mind Nov 7, 2025
db88b64
Trim trailing spaces
pulse-mind Nov 7, 2025
cb081ea
Merge pull request #603 from pulse-mind/decrease-ansible-deprecation-…
otakup0pe Dec 8, 2025
2ff7206
Cleanup old repository
elsoa-invitech Dec 11, 2025
2ea47c3
Use the old postgresql_apt_repository string
elsoa-invitech Dec 15, 2025
6517668
Args warn is deprecated for newer Ansible
Jan 13, 2026
bf1211c
Remove also args.warn for other platforms
Jan 13, 2026
a871348
Merge pull request #607 from elsoa-invitech/old-repo-cleanup
otakup0pe Mar 12, 2026
672d19e
Merge pull request #609 from triviadata/fix/cmd-warn-removed
otakup0pe Apr 19, 2026
9203595
Support Debian 13
exileed Sep 7, 2025
f584098
Merge pull request #610 from hax0rbana-adam/debian_13
otakup0pe May 30, 2026
74075f5
fix: replace systemd restart with pg_ctlcluster restart
JonathanGun Mar 2, 2023
0afc7c3
fix: add support for installing pg on debian 16 and 18
JonathanGun May 31, 2024
2dbdcea
fix: Update user privileges
heryheming Jun 3, 2025
c77c446
fix: add postgresql-server-dev on install-apt
heryheming Sep 25, 2025
3401e94
chore: restore files dropped by upstream (PG 10-12 templates/vars, EO…
heryheming Sep 4, 2026
70878dd
fix: keep postgresql_apt_py3_dependencies and postgresql_apt_py2_dep…
heryheming Sep 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ name: CI
push:
branches:
- development
- decrease-ansible-deprecation-5-0-0
schedule:
- cron: "0 4 * * 4"

Expand All @@ -26,7 +27,7 @@ jobs:
with:
path: 'postgresql'

- name: Set up Python 3.
- name: Set up Python.
uses: actions/setup-python@v5
with:
python-version: '3.x'
Expand All @@ -44,26 +45,38 @@ jobs:
strategy:
matrix:
include:
- distro: rockylinux8
- distro: rockylinux9
# - distro: rockylinux8
# - distro: rockylinux9
- distro: debian11
- distro: debian12
- distro: ubuntu2004
- distro: debian13
- distro: ubuntu2204
- distro: ubuntu2404

steps:
- name: Check out the codebase.
uses: actions/checkout@v4
with:
path: 'postgresql'

- name: Set up Python 3.
- name: Set up Python.
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version: '3.12'

- name: Install test dependencies.
run: pip3 install ansible molecule molecule-plugins[docker] docker
- name: Upgrade pip & install deps
run: |
python -m pip install --upgrade pip wheel setuptools
# Meta-package Ansible 10/11 (include ansible-core ≥2.20)
pip install "ansible>10,<12"
# Testing tools
pip install "molecule" "molecule-plugins[docker]" docker ansible-compat

- name: Show versions
run: |
python -V
ansible --version
molecule --version

- name: Run Molecule tests.
run: molecule -v test
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Icon
test
*.retry
ANXS-postgresql.code-workspace
tests/roles
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,28 +54,28 @@ An example how to include this role as a task:

#### Compatibility matrix

| Distribution / PostgreSQL | 11 | 12 | 13 | 14 | 15 | 16 |
| ------------------------- | :--------: | :----------------: | :----------------: | :----------------: | :----------------: | :-------------: |
| Debian 11.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Debian 12.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Rockylinux 8.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Rockylinux 9.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Ubuntu 20.04.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Ubuntu 22.04.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |

| Distribution / PostgreSQL | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| ------------------------- | :--------: | :--------: | :----------------: | :----------------: | :----------------: | :----------------: | :----------------: |
| Debian 11.x | :no_entry: | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Debian 12.x | :no_entry: | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Debian 13.x | :no_entry: | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Rockylinux 8.x | :no_entry: | :no_entry: | :warning: | :warning: | :warning: | :warning: | :warning: |
| Rockylinux 9.x | :no_entry: | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :warning: |
| Ubuntu 22.04.x | :no_entry: | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Ubuntu 24.04.x | :no_entry: | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |

- :white_check_mark: - tested, works fine
- :warning: - not for production use
- :grey_question: - will work in the future (help out if you can)
- :interrobang: - maybe works, not tested
- :no_entry: - has reached End of Life (EOL)

- :white_check_mark: - works fine
- :warning: - has known issues
- :no_entry: - is unsupported and/or EOL


#### Variables

```yaml
# Basic settings
postgresql_version: 16
postgresql_version: 17
postgresql_encoding: "UTF-8"
postgresql_locale: "en_US.UTF-8"
postgresql_ctype: "en_US.UTF-8"
Expand Down
48 changes: 43 additions & 5 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# file: postgresql/defaults/main.yml

# Basic settings
postgresql_version: 16
postgresql_version: 17
postgresql_version_terse: "{{ postgresql_version | replace('.', '') }}" # Short version of the postgresql_version, used in some path and filenames
postgresql_encoding: "UTF-8"
postgresql_data_checksums: false
Expand Down Expand Up @@ -48,6 +48,7 @@ postgresql_postgis_release_compatibility:
14: "3.2"
15: "3.2"
16: "3.4"
17: "3.5"

postgresql_ext_postgis_version: "{{ postgresql_postgis_release_compatibility.get(postgresql_version) }}"
postgresql_ext_postgis_version_terse: "{{ postgresql_ext_postgis_version | replace('.','') }}"
Expand Down Expand Up @@ -153,7 +154,7 @@ postgresql_client_connection_check_interval: 0 # (>= 14)
postgresql_authentication_timeout: 60s # 1s-600s
postgresql_password_encryption: "{{ 'scram-sha-256' if postgresql_version is version_compare('14', '>=') else 'md5' }}" # (>=14.0 set to scram-sha-256 for best security)
posgresql_scram_iterations: 4096 # (>= 16)
postgresql_db_user_namespace: off
postgresql_db_user_namespace: off # (<= 16)

# GSSAPI using Kerberos
postgresql_krb_server_keyfile: "{{ 'FILE:${sysconfdir}/krb5.keytab' if postgresql_version is version_compare('14', '>=') else '' }}"
Expand Down Expand Up @@ -213,15 +214,26 @@ postgresql_dynamic_shared_memory_type: "posix" # the default is the first optio
# mmap
# use none to disable dynamic shared memory
postgresql_min_dynamic_shared_memory: 0MB # (>= 14) (change requires restart)
postgres_vacuum_buffer_usage_limit: 256kB # (>= 16) size of vacuum and analyze buffer access strategy ring;
postgresql_vacuum_buffer_usage_limit: "{{ '256kB' if postgresql_version is version_compare('16', '=') else '2MB' }}" # (>= 16) size of vacuum and analyze buffer access strategy ring;
# 0 to disable vacuum buffer access strategy;
# range 128kB to 16GB

# SLRU buffers (change requires restart)
postgresql_commit_timestamp_buffers: 0 # (>= 17) memory for pg_commit_ts
postgresql_multixact_offset_buffers: 16 # (>= 17) memory for pg_multixact/offsets
postgresql_multixact_member_buffers: 32 # (>= 17) memory for pg_multixact/members
postgresql_notify_buffers: 16 # (>= 17) memory for pg_notify
postgresql_serializable_buffers: 32 # (>= 17) memory for pg_serial
postgresql_subtransaction_buffers: 0 # (>= 17) memory for pg_subtrans (0 = auto)
postgresql_transaction_buffers: 0 # (>= 17) memory for pg_xact (0 = auto)

# - Disk -

# limits per-process temp file space in kB, or -1 for no limit (>= 9.2)
postgresql_temp_file_limit: -1

postgresql_max_notify_queue_pages: 1048576 # (>= 17)

# - Kernel Resources -

postgresql_max_files_per_process: 1000 # min 25, (>= 13) min 64
Expand All @@ -246,12 +258,13 @@ postgresql_bgwriter_flush_after: 512kB # measured in pages, 0 disables
postgresql_backend_flush_after: 0 # (>= 9.6) 0 disables, default is 0
postgresql_effective_io_concurrency: 1 # 1-1000; 0 disables prefetching
postgresql_maintenance_io_concurrency: 10 # (>= 13)
postgresql_io_combine_limit: 128kB # (>= 17) usually 1-32 blocks (depends on OS)
postgresql_max_worker_processes: 8 # (change requires restart)
postgresql_max_parallel_workers_per_gather: 2 # (>= 9.6) taken from max_worker_processes
postgresql_max_parallel_maintenance_workers: 2 # (>= 11) taken from max_parallel_workers
postgresql_max_parallel_workers: 8 # (>= 10)
postgresql_parallel_leader_participation: on # (>= 11)
postgresql_old_snapshot_threshold: -1 # (>= 9.6) 1min-60d; -1 disables; 0 is immediate
postgresql_old_snapshot_threshold: -1 # (>= 9.6 and <= 16) 1min-60d; -1 disables; 0 is immediate
# (change requires restart)

#------------------------------------------------------------------------------
Expand Down Expand Up @@ -321,6 +334,10 @@ postgresql_recovery_target_inclusive: "" # (>= 12)
postgresql_recovery_target_timeline: "latest" # (>= 12)
postgresql_recovery_target_action: "pause" # (>= 12)

# - WAL Summarization -
postgresql_summarize_wal: off # (>= 17) run WAL summarizer process?
postgresql_wal_summary_keep_time: 10d # (>= 17) when to remove old summary files, 0 = never

#------------------------------------------------------------------------------
# REPLICATION
#------------------------------------------------------------------------------
Expand All @@ -342,6 +359,7 @@ postgresql_track_commit_timestamp: off # (>= 9.5)
# standby servers that provide sync rep.
# number of sync standbys (>= 9.6) and comma-separated list of application_name from standby(s)
postgresql_synchronous_standby_names: [] # '*' means 'all'
postgresql_synchronized_standby_slots: "" # (>= 17) streaming replication standby server slot
postgresql_synchronous_standby_num_sync: "" # >= 9.6 (NOTE: If you use the ANY/ALL syntax in v10, then note the new variable below)
postgresql_synchronous_standby_choose_sync: "FIRST" # >= 10
# number of xacts by which cleanup is delayed
Expand All @@ -368,6 +386,7 @@ postgresql_wal_receiver_timeout: 60s
# time to wait before retrying to retrieve WAL after a failed attempt
postgresql_wal_retrieve_retry_interval: 5s # (>= 9.5)
postgresql_recovery_min_apply_delay: 0 # (>= 12)
postgresql_sync_replication_slots: off # (>= 17) enables slot synchronization on the physical standby from the primary

# - Subscribers - (>= 10)
# These settings are ignored on a publisher.
Expand Down Expand Up @@ -401,6 +420,7 @@ postgres_enable_presorted_aggregate: on # (>= 16)
postgresql_enable_seqscan: on
postgresql_enable_sort: on
postgresql_enable_tidscan: on
postgresql_enable_group_by_reordering: on

# - Planner Cost Constants -
postgresql_seq_page_cost: 1.0 # measured on an arbitrary scale
Expand Down Expand Up @@ -665,6 +685,7 @@ postgresql_default_transaction_deferrable: off
postgresql_session_replication_role: "origin"

postgresql_statement_timeout: 0 # in milliseconds, 0 is disabled
postgresql_transaction_timeout: 0 # (>= 17) in milliseconds, 0 is disabled
postgresql_lock_timeout: 0 # in milliseconds, 0 is disabled (>= 9.3)
postgresql_idle_in_transaction_session_timeout: 0 # in milliseconds, 0 is disabled (>= 9.6)
postgresql_idle_session_timeout: 0 # in milliseconds, 0 is disabled (>= 14)
Expand All @@ -680,6 +701,7 @@ postgresql_xmlbinary: "base64"
postgresql_xmloption: "content"
postgresql_gin_pending_list_limit: 4MB # (>= 9.5)
postgresql_createrole_self_grant: '' # (>= 16) 'set', 'inherit' or 'set, inherit'
postgresql_event_triggers: on # (>= 17)

# - Locale and Formatting -

Expand Down Expand Up @@ -768,6 +790,7 @@ postgresql_sql_inheritance: on # (<= 9.6)
# - Other Platforms and Clients -

postgresql_transform_null_equals: off
postgresql_allow_alter_system: on # (>= 17)

#------------------------------------------------------------------------------
# ERROR HANDLING
Expand Down Expand Up @@ -815,8 +838,23 @@ postgresql_install_repository: true
# APT settings
postgresql_apt_key_id: "ACCC4CF8"
postgresql_apt_key_url: "https://www.postgresql.org/media/keys/ACCC4CF8.asc"
postgresql_apt_repository: "deb http://apt.postgresql.org/pub/repos/apt/ {{ ansible_distribution_release }}-pgdg main {{ postgresql_version }}"
postgresql_apt_repository_url: "https://apt.postgresql.org/pub/repos/apt"
# postgresql_apt_keyring: "/usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg"

# repsoitory base
postgresql_apt_repo_base: "https://apt.postgresql.org/pub/repos/apt"
postgresql_apt_repo_components: "main"

# (codename + -pgdg)
postgresql_apt_suite: "{{ ansible_facts['distribution_release'] | default('') }}-pgdg"

# Ligne de dépôt finale (utilise les variables ci-dessus)
postgresql_apt_repository: >-
deb [signed-by={{ postgresql_apt_keyring }}]
{{ postgresql_apt_repo_base }} {{ postgresql_apt_suite }} {{ postgresql_apt_repo_components }}

# Pin-Priority of PGDG repository
postgresql_apt_pin_enabled: true
postgresql_apt_pin_priority: 500

# YUM repository locations
Expand Down
9 changes: 5 additions & 4 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# file: postgresql/handlers/main.yml

- name: restart postgresql
service:
name: "{{ postgresql_service_name }}"
state: restarted
enabled: yes
shell: "pg_ctlcluster {{ postgresql_version }} {{ postgresql_cluster_name }} restart"

- name: Reload systemd daemon
ansible.builtin.command: systemctl daemon-reload
become: true
58 changes: 29 additions & 29 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# file: postgresql/meta/main.yml

galaxy_info:
Expand All @@ -6,42 +7,41 @@ galaxy_info:
namespace: anxs
role_name: postgresql
description: "Install and configure PostgreSQL, dependencies, extensions, databases and users."
min_ansible_version: 2.4.0
min_ansible_version: 2.12.0
license: MIT

platforms:
- name: Debian
versions:
- stretch
- buster
- name: Debian
versions:
- bullseye
- bookworm

- name: EL
versions:
- 7
- 8
- name: EL
versions:
- "8"
- "9"

- name: Ubuntu
versions:
- bionic
- focal
- xenial
- jammy
- name: Ubuntu
versions:
- focal
- jammy
- noble

- name: Fedora
versions:
- 37
- name: Fedora
versions:
- "40"

galaxy_tags:
- postgresql
- postgres
- database
- database:sql
- sql
- postgis
- debian
- centos
- redhat
- fedora
- ubuntu
- postgresql
- postgres
- database
- database:sql
- sql
- postgis
- debian
- rockylinux
- redhat
- fedora
- ubuntu

dependencies: []
Loading