diff --git a/roles/upgrade/README.md b/roles/upgrade/README.md index 87776aac4..60a73aabf 100644 --- a/roles/upgrade/README.md +++ b/roles/upgrade/README.md @@ -86,6 +86,7 @@ If these checks pass, the playbook switches back to the old PostgreSQL paths and | `pgbouncer_pool_pause_stop_after` | Time in seconds after which the script exits with an error if unable to pause all pgbouncer pools. | `60` | | `pg_slow_active_query_treshold` | Time in milliseconds to wait for active queries before trying to pause the pool. | `1000` | | `pg_slow_active_query_treshold_to_terminate` | Time in milliseconds after reaching "pgbouncer_pool_pause_terminate_after" before the script terminates active queries. | `100` | +| `pgbackrest_stanza_upgrade` | Perform the "stanza-upgrade" command after the upgrade (if 'pgbackrest_install' is 'true'). | `true` | Note: For variables marked as "Derived value", the default value is determined based on other variables. \ Please see the variable file vars/[upgrade.yml](../../vars/upgrade.yml) diff --git a/roles/upgrade/tasks/post_upgrade.yml b/roles/upgrade/tasks/post_upgrade.yml index a803ea168..51de2f6a0 100644 --- a/roles/upgrade/tasks/post_upgrade.yml +++ b/roles/upgrade/tasks/post_upgrade.yml @@ -91,7 +91,7 @@ - name: pgbackrest | Upgrade stanza "{{ pgbackrest_stanza }}" ansible.builtin.command: "pgbackrest --stanza={{ pgbackrest_stanza }} --no-online stanza-upgrade" - when: pg_path_count.stdout | length > 0 + when: pg_path_count.stdout | length > 0 and pgbackrest_stanza_upgrade | bool become: true become_user: postgres ignore_errors: true @@ -125,7 +125,7 @@ delegate_to: "{{ groups['pgbackrest'][0] }}" run_once: true ansible.builtin.command: "pgbackrest --stanza={{ pgbackrest_stanza }} --no-online stanza-upgrade" - when: pg_path_count.stdout | length > 0 + when: pg_path_count.stdout | length > 0 and pgbackrest_stanza_upgrade | bool become: true become_user: "{{ pgbackrest_repo_user }}" ignore_errors: true diff --git a/vars/upgrade.yml b/vars/upgrade.yml index e12bf7a2a..0d37456bc 100644 --- a/vars/upgrade.yml +++ b/vars/upgrade.yml @@ -90,4 +90,7 @@ pg_slow_active_query_treshold: 1000 # terminate active queries that longer than the specified time (in milliseconds) after reaching "pgbouncer_pool_pause_terminate_after" before trying to pause the pool. pg_slow_active_query_treshold_to_terminate: 100 # (0 = terminate all active backends) +# if 'pgbackrest_install' is 'true' +pgbackrest_stanza_upgrade: true # perform the "stanza-upgrade" command after the upgrade. + ...