configpolicy/group_vars
Dustin 164f3b5e0f r/wal-g-pg: Handle versioned storage locations
The target location for WAL archives and backups saved by WAL-G should
be separated based on the major version of PostgreSQL with which they
are compatible.  This will make it easier to restore those backups,
since they can only be restored into a cluster of the same version.

Unfortunately, WAL-G does not natively handle this.  In fact, it doesn't
really have any way of knowing the version of the PostgreSQL server it
is backing up, at least when it is uploading WAL archives.  Thus, we
have to include the version number in the target path (S3 prefix)
manually.  We can't rely on Ansible to do this, because there is no way
to ensure Ansible runs at the appropriate point during the upgrade
process.  As such, we need to be able to modify the target location as
part of the upgrade, without causing a conflict with Ansible the next
time it runs.

To that end, I've changed how the _wal-g-pg_ role creates the
configuration file for WAL-G.  Instead of rendering directly to
`wal-g.yml`, the role renders a template, `wal-g.yml.in`.  This template
can include a `@PGVERSION@` specifier.  The `wal-g-config` script will
then use `sed` to replace that specifier with the version of PostgreSQL
installed on the server, rendering the final `wal-g.yml`.  This script
is called both by Ansible in a handler after generating the template
configuration, and also as a post-upgrade action by the
`postgresql-upgrade` script.

I originally wanted the `wal-g-config` script to use the version of
PostgreSQL specified in the `PG_VERSION` file within the data directory.
This would ensure that WAL-G always uploads/downloads files for the
matching version.  Unfortunately, this introduced a dependency conflict:
the WAL-G configuration needs to be present before a backup can be
restored, but the data directory is empty until after the backup has
been restored.  Thus, we have to use the installed server version,
rather than the data directory version.  This leaves a small window
where WAL-G may be configured to point to the wrong target if the
`postgresql-upgrade` script fails and thus does not trigger regenerating
the configuration file.  This could result in new WAL archives/backups
being uploaded to the old target location.  These files would be
incompatible with the other files in that location, and could
potentially overwrite existing files.  This is rather unlikely, since
the PostgreSQL server will not start if the _postgresql-upgrade.service_
failed.  The only time it should be possible is if the upgrade fails in
such a way that it leaves an empty but valid data directory, and then
the machine is rebooted.
2024-11-17 10:27:31 -06:00
..
dch-gw Move dch_networks definition to all group 2018-10-13 12:43:35 -05:00
public-web r/webites: Add apps.du5t1n.xyz F-Droid repo 2024-11-05 06:47:02 -06:00
pxe hosts: Migrate remaining hosts to Restic 2024-09-07 20:45:24 -05:00
pyrocufflink r/fileserver: Restrict non-administrators to SFTP 2024-02-01 10:29:32 -06:00
synapse synapse: Back up data using BURP 2023-05-23 09:52:50 -05:00
unifi unifi: Scrape logs from UniFi and device syslog 2024-02-28 19:04:30 -06:00
Fedora.yml r/useproxy: Configure system-wide proxy 2024-08-12 18:47:04 -05:00
Fedora37.yml Fedora37: Set collectd SELinux domain permissive 2022-12-19 10:22:00 -06:00
all.yml all: Do not auto-update on weekends 2024-06-21 22:08:03 -05:00
aria2.yml aria2: Deploy aria2 download manager 2018-08-19 14:17:48 -05:00
bitwarden_rs.yml r/bitwarden_rs: Redirect to canonical host name 2024-11-05 06:37:03 -06:00
burp-client.yml hosts: Add burp1.p.b 2020-01-25 13:57:04 -06:00
burp-server.yml burp-server: Keep more backups 2023-07-17 16:36:37 -05:00
collectd.yml Switch Prometheus/collectd to pull 2021-10-30 16:41:17 -05:00
dch-proxy.yml r/webites: Add apps.du5t1n.xyz F-Droid repo 2024-11-05 06:47:02 -06:00
dch-vpn.yml dch-vpn: Avoid configuring firewalld 2018-10-13 12:19:25 -05:00
file-servers.yml hosts: Migrate remaining hosts to Restic 2024-09-07 20:45:24 -05:00
frigate-prod.yml frigate: Configure HTTPS proxy with creds 2024-08-14 20:26:11 -05:00
frigate.yml r/frigate-caddy: Deploy Caddy in front of Frigate 2024-08-12 18:47:04 -05:00
gitea.yml hosts: Migrate remaining hosts to Restic 2024-09-07 20:45:24 -05:00
home-assistant.yml home-assistant: Back up Zigbee/ZWave/Mosquitto 2022-12-23 06:56:52 -06:00
jenkins-slave.yml jenkins-slave: Allow Jenkins to connect to Docker 2019-09-19 19:50:35 -05:00
k8s-controller.yml k8s-controller: Do not reboot after auto-updates 2024-06-23 10:43:15 -05:00
k8s-node.yml hosts: Add Kubernetes machines 2022-08-03 20:52:01 -05:00
koji-hub.yml hosts: Add koji0.pyrocufflink.blue 2018-08-12 10:27:20 -05:00
koji.yml hosts: Add koji0.pyrocufflink.blue 2018-08-12 10:27:20 -05:00
kubelet.yml r/collectd: Ignore filesystems by path 2022-08-05 18:56:48 -05:00
loki.yml r/loki-caddy: Caddy reverse proxy for Loki 2024-11-05 06:54:27 -06:00
minio-backups.yml minio-backups: No syslog for nginx access logs 2024-10-20 12:10:17 -05:00
needproxy.yml r/useproxy: Configure system-wide proxy 2024-08-12 18:47:04 -05:00
nextcloud.yml nextcloud: Scrape logs with Promtail 2024-10-13 18:05:50 -05:00
nut-monitor.yml nut-monitor: Require both UPS to be online 2024-01-25 21:22:04 -06:00
postgresql.yml r/wal-g-pg: Handle versioned storage locations 2024-11-17 10:27:31 -06:00
prometheus.yml Switch Prometheus/collectd to pull 2021-10-30 16:41:17 -05:00
pyrocufflink-dhcp.yml pyrocufflink-dhcp: DHCP reservations for VM hosts 2021-02-17 20:33:41 -06:00
radius.yml Move APs to Management network 2018-07-15 09:19:39 -05:00
repohost.yml r/repohost: Configure Yum package repo host 2023-11-07 20:51:10 -06:00
restic.yml restic: Add role+playbook for Restic backups 2024-09-04 09:40:29 -05:00
samba-dc.yml r/samba-cert: Obtain LDAP/TLS cert via ACME 2024-06-12 18:33:24 -05:00
smtp-relay.yml smtp-relay: Rewrite dustin@hatch.name 2024-08-22 16:17:00 -05:00
taiga.yml taiga: Add playbook for Taiga 2019-09-19 19:51:45 -05:00
vm-hosts.yml hosts: Add loki1.p.b 2024-11-05 06:54:27 -06:00
zabbix-server.yml zabbix-server: Allow SMTP relay from any loopback 2019-04-15 10:05:04 -05:00
zabbix.yml hosts: Add hosts to zabbix group 2018-04-14 15:47:49 -05:00