Skip to content
Open

PG18 #599

Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ An example how to include this role as a task:

```yaml
# Basic settings
postgresql_version: 17
postgresql_version: 18
postgresql_encoding: "UTF-8"
postgresql_locale: "en_US.UTF-8"
postgresql_ctype: "en_US.UTF-8"
Expand Down
43 changes: 36 additions & 7 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: 17
postgresql_version: 18
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 @@ -49,6 +49,7 @@ postgresql_postgis_release_compatibility:
15: "3.2"
16: "3.4"
17: "3.5"
18: "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 @@ -90,6 +91,9 @@ postgresql_pg_hba_trust_hosts: []
postgresql_pg_hba_custom: []

# pg_ident.conf
# From PostgreSQL 18 the variable PG-USERNAME becomes DATABASE-USERNAME, there is no functional impact.
# Simply, the official documentation and error messages will use DATABASE-USERNAME
# pg_username variable continues to be used here.
postgresql_pg_ident:
- comment: "root is allowed to login as {{ postgresql_admin_user }}"
mapname: "root_as_{{ postgresql_admin_user }}"
Expand Down Expand Up @@ -153,7 +157,9 @@ 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_scram_iterations: 4096 # (>= 16)
postgresql_md5_password_warnings: on # (>= 18)
postgresql_oauth_validator_libraries: "" # (>= 18)
postgresql_db_user_namespace: off # (<= 16)

# GSSAPI using Kerberos
Expand All @@ -170,8 +176,10 @@ postgresql_ssl_ciphers:
- "MEDIUM"
- "+3DES"
- "!aNULL"
postgresql_ssl_tls13_ciphers: "" # (>= 18)
postgresql_ssl_prefer_server_ciphers: on
postgresql_ssl_ecdh_curve: "prime256v1"
postgresql_ssl_groups: "X25519:prime256v1" # (>= 18)
postgresql_ssl_ecdh_curve: "prime256v1" # (<= 17)
postgresql_ssl_min_protocol_version: "TLSv1.2" # (>= 12)
postgresql_ssl_max_protocol_version: "" # (>= 12)
postgresql_ssl_dh_params_file: "" # (>= 10)
Expand Down Expand Up @@ -232,6 +240,7 @@ postgresql_transaction_buffers: 0 # (>= 17) memory for pg_xact (0 = auto)
# limits per-process temp file space in kB, or -1 for no limit (>= 9.2)
postgresql_temp_file_limit: -1

postgresql_file_copy_method: copy # (>= 18)
postgresql_max_notify_queue_pages: 1048576 # (>= 17)

# - Kernel Resources -
Expand All @@ -246,6 +255,10 @@ postgresql_vacuum_cost_page_miss: "{{ 2 if postgresql_version is version_compar
postgresql_vacuum_cost_page_dirty: 20 # 0-10000 credits
postgresql_vacuum_cost_limit: 200 # 1-10000 credits

# - Default Behavior -

postgresql_vacuum_truncate: on # (>= 18)

# - Background Writer -

postgresql_bgwriter_delay: 200ms # 10-10000ms between rounds
Expand All @@ -256,9 +269,13 @@ postgresql_bgwriter_flush_after: 512kB # measured in pages, 0 disables
# - Asynchronous Behavior -

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_effective_io_concurrency: "{{ 16 if postgresql_version is version_compare('18', '>=') else 1 }}" # 1-1000; 0 disables prefetching
postgresql_maintenance_io_concurrency: "{{ 16 if postgresql_version is version_compare('18', '>=') else 10 }}" # (>= 13)
postgresql_io_max_combine_limit: 128kB # (>= 18)
postgresql_io_combine_limit: 128kB # (>= 17) usually 1-32 blocks (depends on OS)
postgresql_io_method: worker # (>= 18)
postgresql_io_max_concurrency: -1 # (>= 18)
postgresql_io_workers: 3 # (>= 18)
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
Expand Down Expand Up @@ -350,6 +367,7 @@ postgresql_wal_sender_delay: 1s # walsender cycle time, 1-10000 milliseconds
postgresql_wal_keep_segments: 0 # in logfile segments, 16MB each; 0 disables
postgresql_wal_keep_size: 0 # (>= 13)
postgresql_max_slot_wal_keep_size: -1 # (>= 13)
postgresql_idle_replication_slot_timeout: 0 # (>= 18)
postgresql_replication_timeout: 60s # in milliseconds; 0 disables (<= 9.2)
postgresql_wal_sender_timeout: 60s # in milliseconds; 0 disables (>= 9.3)
postgresql_track_commit_timestamp: off # (>= 9.5)
Expand Down Expand Up @@ -390,6 +408,7 @@ postgresql_sync_replication_slots: off # (>= 17) enables slot synchronizat

# - Subscribers - (>= 10)
# These settings are ignored on a publisher.
postgresql_max_active_replication_origins: 10 # (>= 18)
postgresql_max_logical_replication_workers: 4 # (>= 10) taken from max_worker_processes
# (change requires restart)
postgresql_max_sync_workers_per_subscription: 2 # (>= 10) taken from max_logical_replication_workers
Expand Down Expand Up @@ -421,6 +440,8 @@ postgresql_enable_seqscan: on
postgresql_enable_sort: on
postgresql_enable_tidscan: on
postgresql_enable_group_by_reordering: on
postgresql_enable_distinct_reordering: on # (>= 18)
postgresql_enable_self_join_elimination: on # (>= 18)

# - Planner Cost Constants -
postgresql_seq_page_cost: 1.0 # measured on an arbitrary scale
Expand Down Expand Up @@ -549,7 +570,7 @@ postgresql_debug_print_plan: off
postgresql_debug_pretty_print: on
postgresql_log_autovacuum_min_duration: "{{ '10min' if postgresql_version is version_compare('15', '>=') else -1 }}"
postgresql_log_checkpoints: "{{ 'on' if postgresql_version is version_compare('15', '>=') else 'off' }}"
postgresql_log_connections: off
postgresql_log_connections: "{{ '' if postgresql_version is version_compare('18', '>=') else 'off' }}"
postgresql_log_disconnections: off
postgresql_log_duration: off
postgresql_log_error_verbosity: "default" # terse, default, or verbose messages
Expand Down Expand Up @@ -582,6 +603,7 @@ postgresql_log_line_prefix: "%m [%p] "

# log lock waits >= deadlock_timeout
postgresql_log_lock_waits: off
postgresql_log_lock_failures: off # (>= 18)
postgresql_log_recovery_conflict_waits: off # (>= 14)
postgresql_log_parameter_max_length: -1 # (>= 13)
postgresql_log_parameter_max_length_on_error: 0 # (>= 13)
Expand All @@ -606,6 +628,7 @@ postgresql_update_process_title: on # (>= 9.2)
postgresql_track_activities: on
postgresql_track_activity_query_size: 1024
postgresql_track_counts: on
postgresql_track_cost_delay_timing: off # (>= 18)
postgresql_track_io_timing: off # (>= 9.2)
postgresql_track_wal_io_timing: off # (>= 14)
postgresql_track_functions: "none" # none, pl, all
Expand All @@ -627,6 +650,8 @@ postgresql_log_statement_stats: off
postgresql_autovacuum: on
# -1 disables, 0 logs all actions and their durations, > 0 logs only
# actions running at least this number of milliseconds.
# autovacuum worker slots to allocate
postgresql_autovacuum_worker_slots: 16 # (>= 18)
# max number of autovacuum subprocesses
postgresql_autovacuum_max_workers: 3
# time between autovacuum runs
Expand All @@ -641,6 +666,8 @@ postgresql_autovacuum_vacuum_scale_factor: 0.2
postgresql_autovacuum_vacuum_insert_scale_factor: 0.2 # (>= 13)
# fraction of table size before analyze
postgresql_autovacuum_analyze_scale_factor: 0.1
# max number of row updates
postgresql_autovacuum_vacuum_max_threshold: 100000000 # (>= 18)
# maximum XID age before forced vacuum
postgresql_autovacuum_freeze_max_age: 200000000
# maximum Multixact age before forced vacuum (>= 9.3)
Expand Down Expand Up @@ -695,6 +722,7 @@ postgresql_vacuum_failsafe_age: 1600000000 # (>= 14)
postgresql_vacuum_multixact_freeze_table_age: 150000000 # (>= 9.3)
postgresql_vacuum_multixact_freeze_min_age: 5000000 # (>= 9.3)
postgresql_vacuum_multixact_failsafe_age: 1600000000 # (>= 14)
postgresql_vacuum_max_eager_freeze_failure_rate: 0.03 # (>= 18)
postgresql_vacuum_cleanup_index_scale_factor: 0.1 # (>= 11 and <= 13)
postgresql_bytea_output: "hex" # hex, escape
postgresql_xmlbinary: "base64"
Expand Down Expand Up @@ -748,7 +776,8 @@ postgresql_jit_provider: "llvmjit" # (>= 11)
# - Other Defaults -

postgresql_dynamic_library_path: "$libdir"
postgresql_extension_destdir: "" # prepend path when loading extensions
postgresql_extension_control_path: "$system" # (>= 18)
postgresql_extension_destdir: "" # (<= 17) # prepend path when loading extensions
# and shared objects (added by Debian)

postgresql_gin_fuzzy_search_limit: 0
Expand Down
16 changes: 8 additions & 8 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,47 @@ lint: |
# yamllint .
# ansible-lint
platforms:
- name: postgresql-12
- name: postgresql-13
image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
privileged: true
pre_build_image: true
cgroupns_mode: host
command: ${MOLECULE_DOCKER_COMMAND:-""}
- name: postgresql-13
- name: postgresql-14
image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
privileged: true
pre_build_image: true
cgroupns_mode: host
command: ${MOLECULE_DOCKER_COMMAND:-""}
- name: postgresql-14
- name: postgresql-15
image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
privileged: true
pre_build_image: true
cgroupns_mode: host
command: ${MOLECULE_DOCKER_COMMAND:-""}
- name: postgresql-15
- name: postgresql-16
image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
privileged: true
pre_build_image: true
cgroupns_mode: host
command: ${MOLECULE_DOCKER_COMMAND:-""}
- name: postgresql-16
- name: postgresql-17
image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
privileged: true
pre_build_image: true
cgroupns_mode: host
command: ${MOLECULE_DOCKER_COMMAND:-""}
- name: postgresql-17
- name: postgresql-18
image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest"
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
Expand All @@ -66,8 +66,6 @@ provisioner:
converge: ${MOLECULE_PLAYBOOK:-../../tests/playbook.yml}
inventory:
host_vars:
postgresql-12:
postgresql_version: 12
postgresql-13:
postgresql_version: 13
postgresql-14:
Expand All @@ -78,5 +76,7 @@ provisioner:
postgresql_version: 16
postgresql-17:
postgresql_version: 17
postgresql-18:
postgresql_version: 18
verifier:
name: ansible
2 changes: 1 addition & 1 deletion templates/pg_ident.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
# Put your actual configuration here
# ----------------------------------

# MAPNAME SYSTEM-USERNAME PG-USERNAME
# MAPNAME SYSTEM-USERNAME PG-USERNAME (and DATABASE-USERNAME from PG18)
{% for pg_ident in postgresql_pg_ident %}
{% if pg_ident.comment is defined %}
# {{ pg_ident.comment }}
Expand Down
2 changes: 1 addition & 1 deletion templates/postgresql.conf-16.j2
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ client_connection_check_interval = {{ postgresql_client_connection_check_interva

authentication_timeout = {{ postgresql_authentication_timeout }} # 1s-600s
password_encryption = {{ postgresql_password_encryption }} # scram-sha-256 or md5
scram_iterations = {{ posgresql_scram_iterations }}
scram_iterations = {{ postgresql_scram_iterations }}
db_user_namespace = {{ 'on' if postgresql_db_user_namespace else 'off' }}

# GSSAPI using Kerberos
Expand Down
2 changes: 1 addition & 1 deletion templates/postgresql.conf-17.j2
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ client_connection_check_interval = {{ postgresql_client_connection_check_interva

authentication_timeout = {{ postgresql_authentication_timeout }} # 1s-600s
password_encryption = {{ postgresql_password_encryption }} # scram-sha-256 or md5
scram_iterations = {{ posgresql_scram_iterations }}
scram_iterations = {{ postgresql_scram_iterations }}

# GSSAPI using Kerberos
krb_server_keyfile = '{{ postgresql_krb_server_keyfile }}'
Expand Down
Loading
Loading