Skip to content

Commit

Permalink
config_pgcluster: Create extensions after restarting Postgres (if req…
Browse files Browse the repository at this point in the history
…uired) (#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`).
  • Loading branch information
vitabaks authored Sep 18, 2024
1 parent 714fd72 commit 278ba61
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions automation/config_pgcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -366,5 +363,7 @@
ansible.builtin.include_vars: "vars/{{ ansible_os_family }}.yml"
tags: always
roles:
- role: postgresql-extensions

# finish (info)
- role: deploy-finish

0 comments on commit 278ba61

Please sign in to comment.