From 971189cf27b0f71a3d6cc56af2d19c2ca4f879c9 Mon Sep 17 00:00:00 2001 From: Zsolt Parragi Date: Thu, 24 Sep 2026 11:07:26 +0000 Subject: [PATCH] PG-2795 install_ppg_tools: one task layout for every major - pgvector moves up next to the other extensions for 14/15/16, where it sat after etcd together with a second, oddly gated copy of the etcd and haproxy deb install that the unconditional copy right after it made redundant (legacy_layout, patroni_deb_gate) - pg_tde install follows from major >= 17, pg_oidc_validator from major >= 18 (oidc) - drop the etcd restart right after its rpm install, nothing configures etcd in between and Start etcd follows later, pg-15 never had it (etcd_restart) - 17 and 18 gated the versioned pgaudit/postgis rpm names on >= X.0, set them directly instead (vars_gate) - one set of comments around shared_preload_libraries --- ppg/versions.yml | 10 --- templates/tasks/install_ppg_tools.yml.j2 | 91 ++++-------------------- 2 files changed, 15 insertions(+), 86 deletions(-) diff --git a/ppg/versions.yml b/ppg/versions.yml index 150f0cb1..e2cec4e5 100644 --- a/ppg/versions.yml +++ b/ppg/versions.yml @@ -136,8 +136,6 @@ instances: pgvector_gate: '14.15' cron_gate: '14.22' base_extensions: '[''pg_stat_monitor'', ''pgaudit'', ''set_user'']' - legacy_layout: true - patroni_deb_gate: '14.12' pgpool_start_gate: '14.7' pg-15: major: 15 @@ -259,9 +257,6 @@ instances: pgvector_gate: '15.10' cron_gate: '15.17' base_extensions: '[''pg_stat_monitor'', ''pgaudit'', ''set_user'', ''percona_pg_telemetry'']' - legacy_layout: true - etcd_restart: false - patroni_deb_gate: '15.7' pgpool_start_gate: '15.2' pg-16: major: 16 @@ -367,8 +362,6 @@ instances: pgvector_gate: '16.6' cron_gate: '16.13' base_extensions: '[''percona_pg_telemetry'', ''pg_stat_monitor'', ''pgaudit'', ''set_user'']' - legacy_layout: true - patroni_deb_gate: '16.3' pg-17: major: 17 flavor: ppg @@ -484,7 +477,6 @@ instances: install: dev_switch_cutoff: '17.4' install_tools: - vars_gate: '17.0' pgpool_switch: '17.10' pgvector_gate: '17.2' tde_gate: '17.7' @@ -553,10 +545,8 @@ instances: telemetry_upgrade_verify: false install: {} install_tools: - vars_gate: '18.0' pgpool_switch: '18.4' cron_gate: '18.3' - oidc: true base_extensions: '[''pg_stat_monitor'', ''pgaudit'', ''set_user'', ''pg_tde'']' psp-16: major: 16 diff --git a/templates/tasks/install_ppg_tools.yml.j2 b/templates/tasks/install_ppg_tools.yml.j2 index da6e5e7f..613128f1 100644 --- a/templates/tasks/install_ppg_tools.yml.j2 +++ b/templates/tasks/install_ppg_tools.yml.j2 @@ -1,4 +1,5 @@ --- +<% if vars_gate is defined %> - name: Setting facts so that they will be persisted in the fact cache ansible.builtin.set_fact: pgaudit_rhel_package_name: "percona-pgaudit" @@ -9,6 +10,12 @@ pgaudit_rhel_package_name: "percona-pgaudit<< major >>" postgis_rhel_package_name_prefix: "percona-postgis35_<< major >>" when: (pg_version_to_install | string is version('<< vars_gate >>', '>=', strict=True)) +<% else %> + - name: Setting facts so that they will be persisted in the fact cache + ansible.builtin.set_fact: + pgaudit_rhel_package_name: "percona-pgaudit<< major >>" + postgis_rhel_package_name_prefix: "percona-postgis35_<< major >>" +<% endif %> - debug: msg: "Value of pgaudit_rhel_package_name is : {{ pgaudit_rhel_package_name }}" @@ -457,7 +464,6 @@ when: ansible_os_family == "Debian" <% endif %> -<% if not legacy_layout | default(false) %> - name: Install pgvector packages RHEL yum: name: "{{ packages }}" @@ -489,6 +495,7 @@ when: ansible_os_family == "Debian" <% endif %> +<% if major >= 17 %> - name: Install pg_tde packages RHEL yum: name: "{{ packages }}" @@ -522,7 +529,8 @@ when: ansible_os_family == "Debian" <% endif %> -<% if oidc | default(false) %> +<% endif %> +<% if major >= 18 %> - name: Install pg_oidc_validator packages RHEL yum: name: "{{ packages }}" @@ -544,7 +552,7 @@ when: (ansible_os_family == "Debian" and pg_version_to_install | string is version('<< major >>.2', '>=', strict=True)) <% endif %> -<% endif %> - name: Install pg_cron packages RHEL + - name: Install pg_cron packages RHEL yum: name: "{{ packages }}" state: latest @@ -570,24 +578,9 @@ - name: Configure shared_preload_libraries vars: -<% if oidc | default(false) %> - # 1. Define base extensions +<% if major >= 18 %> # pg_oidc_validator is NOT preloaded; it is tested as a regular extension via CREATE EXTENSION - base_extensions: << base_extensions >> - - # 2. Conditionally add pg_cron (available from << major >>.4 onwards) - final_extensions: >- - {{ - base_extensions - + (['pg_cron'] if ( - pg_version_to_install | string is version('<< cron_gate >>', '>', strict=True) - ) else []) - }} - - # 3. Handle OS-specific paths dynamically - pg_conf_path: "{{ '/etc/postgresql/<< major >>/main/postgresql.conf' if ansible_os_family == 'Debian' else '/var/lib/pgsql/<< major >>/data/postgresql.conf' }}" - -<% else %> +<% endif %> base_extensions: << base_extensions >> final_extensions: >- {{ @@ -597,22 +590,15 @@ ) else []) }} pg_conf_path: "{{ '/etc/postgresql/<< major >>/main/postgresql.conf' if ansible_os_family == 'Debian' else '/var/lib/pgsql/<< major >>/data/postgresql.conf' }}" -<% if not legacy_layout | default(false) %> - -<% endif %> -<% endif %> ansible.builtin.lineinfile: path: "{{ pg_conf_path }}" regexp: '^#?shared_preload_libraries\s*=' line: "shared_preload_libraries = '{{ final_extensions | join(', ') }}'" state: present become: true -<% if oidc | default(false) %> - # Only run if it's one of your supported families -<% endif %> when: ansible_os_family in ["Debian", "RedHat"] -<% if oidc | default(false) %> +<% if major >= 18 %> - name: Configure pg_oidc_validator settings in postgresql.conf blockinfile: path: "{{ '/etc/postgresql/<< major >>/main/postgresql.conf' if ansible_os_family == 'Debian' else '/var/lib/pgsql/<< major >>/data/postgresql.conf' }}" @@ -662,7 +648,7 @@ host replication all ::1/128 trust when: ansible_os_family == "Debian" -<% if oidc | default(false) %> +<% if major >= 18 %> - name: Add OIDC entry to pg_hba.conf RHEL lineinfile: path: /var/lib/pgsql/<< major >>/data/pg_hba.conf @@ -707,53 +693,6 @@ - python3-etcd when: ansible_os_family == "RedHat" -<% if etcd_restart | default(true) %> - - name: Restart etcd RHEL - include_tasks: "{{ role_path }}/../../tasks/start_service_with_diagnostics.yml" - vars: - svc_name: etcd - svc_state: restarted - when: ansible_os_family == "RedHat" - -<% endif %> -<% if legacy_layout | default(false) %> - - name: Install pgvector packages RHEL - yum: - name: "{{ packages }}" - state: latest - update_cache: yes - vars: - packages: - - percona-pgvector_<< major >> - - percona-pgvector_<< major >>-debuginfo - - percona-pgvector_<< major >>-debugsource - - percona-pgvector_<< major >>-llvmjit - when: (ansible_os_family == "RedHat" and pg_version_to_install | string is version('<< pgvector_gate >>', '>=', strict=True)) - - - name: Install pgvector packages Debian - apt: - name: "{{ packages }}" - state: latest - update_cache: yes - vars: - packages: - - percona-postgresql-<< major >>-pgvector - when: (ansible_os_family == "Debian" and pg_version_to_install | string is version('<< pgvector_gate >>', '>=', strict=True)) - - - name: Install patroni related packages Debian - apt: - name: "{{ packages }}" - state: latest - update_cache: yes - vars: - packages: - - etcd - - percona-haproxy - when: (ansible_distribution == "Ubuntu") or - (ansible_os_family == "Debian" and ansible_lsb.major_release|int <= 11) or - (ansible_os_family == "Debian" and pg_version_to_install | string is version('<< patroni_deb_gate >>', '>=', strict=True)) - -<% endif %> - name: Install patroni related packages Debian apt: name: "{{ packages }}"