From 278ba614034445416026da15e359b17d0e6b79d1 Mon Sep 17 00:00:00 2001 From: Vitaliy Kukharik <37010174+vitabaks@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:56:22 +0300 Subject: [PATCH] config_pgcluster: Create extensions after restarting Postgres (if required) (#761) Previously, the role for creating extensions was executed before the restart, which could result in errors, example: failed: [10.129.50.35] (item={'ext': 'pg_cron', 'db': 'postgres', 'schema': 'pg_catalog'}) => {"ansible_loop_var": "item", "changed": false, "item": {"db": "postgres", "ext": "pg_cron", "schema": "pg_catalog"}, "msg": "Management of PostgreSQL extension failed: pg_cron can only be loaded via shared_preload_libraries\nHINT: Add pg_cron to the shared_preload_libraries configuration variable in ********ql.conf.\n"} Now, extensions will be created after the restart. Note: If the `pending_restart: true` variable is set, the cluster will be restarted if required (e.g., when changing `shared_preload_libraries`). --- automation/config_pgcluster.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/automation/config_pgcluster.yml b/automation/config_pgcluster.yml index 2c474640b..106b0713f 100644 --- a/automation/config_pgcluster.yml +++ b/automation/config_pgcluster.yml @@ -202,9 +202,6 @@ - role: postgresql-privs when: inventory_hostname in groups['primary'] - - role: postgresql-extensions - when: inventory_hostname in groups['primary'] - - role: wal-g when: wal_g_install | bool @@ -347,7 +344,7 @@ tags: - patroni_conf -- name: config_pgcluster.yml | PostgreSQL Cluster Info +- name: config_pgcluster.yml | Configure PostgreSQL Cluster and info hosts: primary become: true become_method: sudo @@ -366,5 +363,7 @@ ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml" tags: always roles: + - role: postgresql-extensions + # finish (info) - role: deploy-finish