From f3f1df29d94d50b4525df8f2210f6f9feb4201b8 Mon Sep 17 00:00:00 2001 From: Aine Date: Fri, 1 Nov 2024 19:11:00 +0200 Subject: [PATCH] fix borg postgres version check --- roles/galaxy/backup_borg/defaults/main.yml | 10 ++++---- .../backup_borg/meta/.galaxy_install_info | 6 ++--- roles/galaxy/backup_borg/tasks/install.yml | 23 +++++++++++-------- upstream | 2 +- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/roles/galaxy/backup_borg/defaults/main.yml b/roles/galaxy/backup_borg/defaults/main.yml index 88f0020..c0fa7f7 100644 --- a/roles/galaxy/backup_borg/defaults/main.yml +++ b/roles/galaxy/backup_borg/defaults/main.yml @@ -27,8 +27,8 @@ backup_borg_version: "{{ (backup_borg_postgres_version ~ '-' ~ backup_borg_borg_ backup_borg_postgres_version: "" backup_borg_borg_version: 1.2.8 backup_borg_borgmatic_version: 1.8.13 -backup_borg_docker_image: "{{ backup_borg_docker_image_name_prefix }}etke.cc/borgmatic:{{ backup_borg_version }}" -backup_borg_docker_image_name_prefix: "{{ 'localhost/' if backup_borg_container_image_self_build else 'registry.gitlab.com/' }}" +backup_borg_docker_image: "{{ backup_borg_docker_image_name_prefix }}etkecc/borgmatic:{{ backup_borg_version }}" +backup_borg_docker_image_name_prefix: "{{ 'localhost/' if backup_borg_container_image_self_build else 'ghcr.io/' }}" backup_borg_docker_image_force_pull: "{{ backup_borg_docker_image.endswith(':latest') }}" # container tmp directory size @@ -60,10 +60,10 @@ backup_borg_postgresql_databases_hostname: '' backup_borg_postgresql_databases_username: "{{ backup_borg_identifier }}" backup_borg_postgresql_databases_password: "" backup_borg_postgresql_databases_port: 5432 -backup_borg_postgresql_version_detection_enabled: "{{ backup_borg_postgresql_version_detection_devture_postgres_role_name != '' }}" -# backup_borg_postgresql_version_detection_devture_postgres_role_name lets you control the role name, leading to the com.devture.ansible.role.postgres. +backup_borg_postgresql_version_detection_enabled: "{{ backup_borg_postgresql_version_detection_postgres_role_name != '' }}" +# backup_borg_postgresql_version_detection_postgres_role_name lets you control the role name, leading to the com.devture.ansible.role.postgres. # This role is invoked to determine the Postgres version, unless you have set `backup_borg_version` manually. -backup_borg_postgresql_version_detection_devture_postgres_role_name: '' +backup_borg_postgresql_version_detection_postgres_role_name: '' backup_borg_mysql_enabled: true backup_borg_mysql_databases: [] diff --git a/roles/galaxy/backup_borg/meta/.galaxy_install_info b/roles/galaxy/backup_borg/meta/.galaxy_install_info index e627991..acbbaab 100644 --- a/roles/galaxy/backup_borg/meta/.galaxy_install_info +++ b/roles/galaxy/backup_borg/meta/.galaxy_install_info @@ -1,3 +1,3 @@ -install_date: 'Mon 07 Oct 2024 02:00:09 PM ' -install_commit: d54ccb7cf11f6612a220bf2081ec3c051c2e046f -version: v1.2.8-1.8.13-0 +install_date: 'Fri 01 Nov 2024 05:10:49 PM ' +install_commit: 1db81bb43c86d1408e3e0c2631e813e7057e5559 +version: v1.2.8-1.8.13-2 diff --git a/roles/galaxy/backup_borg/tasks/install.yml b/roles/galaxy/backup_borg/tasks/install.yml index dca45bb..b1fca1c 100644 --- a/roles/galaxy/backup_borg/tasks/install.yml +++ b/roles/galaxy/backup_borg/tasks/install.yml @@ -2,33 +2,36 @@ - when: backup_borg_postgresql_enabled | bool and backup_borg_postgresql_version_detection_enabled | bool and backup_borg_postgres_version == '' block: - - name: Fail with devture_postgres_enabled is undefined + - name: Fail with postgres_enabled is undefined ansible.builtin.fail: msg: >- You have not set `backup_borg_postgres_version`, which means we'll attempt to auto-detect it. - Auto-detection expects that you're running the `com.devture.ansible.role.postgres role`. + Auto-detection expects that you're running the `postgres role`. You either need to run Postgres via that role, or you need to set `backup_borg_postgres_version` manually. - when: devture_postgres_enabled is not defined + when: postgres_enabled is not defined - - name: Fail with devture_postgres_enabled not enabled + - name: Fail with postgres_enabled not enabled ansible.builtin.fail: msg: >- - You are not running a built-in Postgres server (`devture_postgres_enabled: false`), so auto-detecting its version and setting `backup_borg_postgres_version` automatically based on that cannot happen. + You are not running a built-in Postgres server (`postgres_enabled: false`), so auto-detecting its version and setting `backup_borg_postgres_version` automatically based on that cannot happen. Consider setting `backup_borg_postgres_version` to your Postgres version manually. - when: not devture_postgres_enabled + when: not postgres_enabled - ansible.builtin.include_role: - name: "{{ backup_borg_postgresql_version_detection_devture_postgres_role_name }}" + name: "{{ backup_borg_postgresql_version_detection_postgres_role_name }}" tasks_from: detect_existing_postgres_version + - debug: + msg: "Detected Postgres version: {{ postgres_detected_version }}" + - name: Fail if detected Postgres version is unsupported ansible.builtin.fail: - msg: "You cannot use borg backup with such an old version ({{ devture_postgres_detected_version }}) of Postgres. Consider upgrading - link to docs for upgrading Postgres: docs/maintenance-postgres.md#upgrading-postgresql" - when: "devture_postgres_detected_version not in backup_borg_supported_postgres_versions" + msg: "You cannot use borg backup with Postgres v{{ postgres_detected_version }}. If you are using an old Postgres version, consider upgrading - link to docs for upgrading Postgres: docs/maintenance-postgres.md#upgrading-postgresql HOWEVER, if you are using a new Postgres version, there is a high chance that the version is not supported by borg backup yet (supported versions: {{ backup_borg_supported_postgres_versions }}). You can't do anything with that, details: https://github.com/etkecc/borgmatic/pull/1" + when: "postgres_detected_version not in backup_borg_supported_postgres_versions" - name: Set the correct borg backup version to use ansible.builtin.set_fact: - backup_borg_postgres_version: "{{ devture_postgres_detected_version }}" + backup_borg_postgres_version: "{{ postgres_detected_version }}" - name: Ensure borg docker data paths exist ansible.builtin.file: diff --git a/upstream b/upstream index 177e49a..39018f7 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit 177e49ab47e00af00e71c3ec67662e778f6e4ba8 +Subproject commit 39018f7f4da6f44485a94eb8b2d44c079b5c68b4