r/pgsql-server-base: Add post-upgrade capability
The `postgresql-upgrade` script will now run any executables located in the `/etc/postgresql/post-upgrade.d` directory. This will allow making arbitrary changes to the system after a PostgreSQL major version upgrade. Notably, we will use this capability to change the WAL-G configuration to upload WAL archives and backups to the correct version-specific location.dynamic-inventory
parent
965742d2b0
commit
e861883627
|
@ -38,3 +38,13 @@ runuser -u postgres -- pg_upgrade \
|
||||||
-o '-c restore_command= -c archive_command=' \
|
-o '-c restore_command= -c archive_command=' \
|
||||||
-O '-c restore_command= -c archive_command=' \
|
-O '-c restore_command= -c archive_command=' \
|
||||||
-k
|
-k
|
||||||
|
|
||||||
|
for f in /etc/postgresql/post-upgrade.d/*; do
|
||||||
|
if [ -x "${f}" ]; then
|
||||||
|
printf 'Running post-update script: %s\n' "${f}" >&2
|
||||||
|
"${f}" || {
|
||||||
|
printf 'Post-update script %s failed\n' "${f}" >&2
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
|
@ -29,6 +29,16 @@
|
||||||
- postgresql-upgrade
|
- postgresql-upgrade
|
||||||
- systemd
|
- systemd
|
||||||
|
|
||||||
|
- name: ensure postgresql post-upgrade directory exists
|
||||||
|
file:
|
||||||
|
path: /etc/postgresql/post-upgrade.d
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: u=rwx,go=rx
|
||||||
|
state: directory
|
||||||
|
tags:
|
||||||
|
- postgresql-upgrade
|
||||||
|
|
||||||
- name: ensure postgresql-upgrade service starts when needed
|
- name: ensure postgresql-upgrade service starts when needed
|
||||||
service:
|
service:
|
||||||
name: postgresql-upgrade
|
name: postgresql-upgrade
|
||||||
|
|
Loading…
Reference in New Issue