From c10baec86f79f3ab8ff3bcef4ffea80be613bce7 Mon Sep 17 00:00:00 2001 From: Arthur BOUDREAULT Date: Thu, 15 Dec 2022 09:37:32 +0000 Subject: [PATCH] fix(ynh_backup): fix borgmatic version Some arguments in borgmatic cli don't work anymore. They have been replaced in the latest commits of the Ansible role yet no new release have been published yet. Therefore, we are going to fix the borgmatic version to an older which works with Ansible role 0.9.3. https://github.com/borgbase/ansible-role-borgbackup --- roles/ynh_backup/README-FR.md | 2 ++ roles/ynh_backup/README.md | 2 ++ roles/ynh_backup/defaults/main.yml | 1 + roles/ynh_backup/tasks/borgbackup.yml | 11 ++++++++++- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/roles/ynh_backup/README-FR.md b/roles/ynh_backup/README-FR.md index 119698e..e354b28 100644 --- a/roles/ynh_backup/README-FR.md +++ b/roles/ynh_backup/README-FR.md @@ -49,6 +49,7 @@ ynh_backup: ```yml ynh_borg_backup_scheduled: True m3nu_ansible_role_borgbackup_version: "v0.9.3" +borgmatic_version: "1.6.5" borg_source_directories: "{{ ynh_backup.directory }}" borg_repository: "/data/backup/borg_repository" borg_encryption_passphrase: "PLEASECHANGEME" @@ -64,6 +65,7 @@ ynh_ssh_borg_command: "ssh_command: ssh -p 7410 -o StrictHostKey - `ynh_borg_backup_scheduled` : Active / désactive la fonctionnalité de sauvegarde avec BorgBackup. - `m3nu_ansible_role_borgbackup_version` : Vous permet de spécifier la version du rôle Ansible Borg Backup que vous souhaitez utiliser. La version par défaut du rôle est v0.9.3 mais vous pouvez vérifier les versions du rôle [ici](https://github.com/borgbase/ansible-role-borgbackup). +- `borgmatic_version`: Vous permet de spécifier la version de Borgmatic que vous souhaitez utiliser. La version par défaut est la 1.6.5 car la dernière release du rôle n'est pas compatible avec les mises à jour plus récentes de Borgmatic (pour le moment). - `ynh_borg_backup_remote_repo` : Active / désactive la fonctionnalité de sauvegarde sur un dépôt distant BorgBackup (tâches liées à la mise en place des clés SSH). Si vous activez cette fonctionnalité, vous aurez besoin d'utiliser les variables `borg_ssh_keys_src` et `borg_ssh_keys_dest`. - `borg_source_directories` : Liste des dossiers source à sauvegarder. Par défaut, il s'agit du dossier qui contient les sauvegardes faites par YunoHost. - `borg_repository` : Chemin complet vers le dépôt Borg. Possibilité de donner une liste de dépôts pour sauvegarder les données dans plusieurs endroits. diff --git a/roles/ynh_backup/README.md b/roles/ynh_backup/README.md index 8806100..fe23b49 100644 --- a/roles/ynh_backup/README.md +++ b/roles/ynh_backup/README.md @@ -49,6 +49,7 @@ ynh_backup: ```yml ynh_borg_backup_scheduled: True m3nu_ansible_role_borgbackup_version: "v0.9.3" +borgmatic_version: "1.6.5" borg_source_directories: "{{ ynh_backup.directory }}" borg_repository: "/data/backup/borg_repository" borg_encryption_passphrase: "PLEASECHANGEME" @@ -64,6 +65,7 @@ ynh_ssh_borg_command: "ssh_command: ssh -p 7410 -o StrictHostKey - `ynh_borg_backup_scheduled`: Enable / disable the backup feature with BorgBackup. - `m3nu_ansible_role_borgbackup_version`: Allows you to specify which version of the Borg Backup Ansible role you want to use. The default version of the role is v0.9.3 but you can check the releases of the role [here](https://github.com/borgbase/ansible-role-borgbackup). +- `borgmatic_version`: Allows you to specify which version of Borgmatic you want to use. The default version is 1.6.5 because previous release of the role are not compatible with more recent updates of Borgmatic (at the moment). - `ynh_borg_backup_remote_repo`: Enable / disable the backup functionality on a BorgBackup remote repository (tasks related to SSH keys setup). If you enable this feature, then you will need to use `borg_ssh_keys_src` and `borg_ssh_keys_dest` variables. - `borg_source_directories`: List of source folders to back up. By default, this is the folder in which YunoHost local backups are located. - `borg_repository`: Full path to the Borg repository. Possibility to give a list of repositories to save data in several places. diff --git a/roles/ynh_backup/defaults/main.yml b/roles/ynh_backup/defaults/main.yml index a52daba..45ed90b 100644 --- a/roles/ynh_backup/defaults/main.yml +++ b/roles/ynh_backup/defaults/main.yml @@ -25,6 +25,7 @@ ynh_backup: # Variables for YunoHost BorgBackup ynh_borg_backup_scheduled: False m3nu_ansible_role_borgbackup_version: "v0.9.3" +borgmatic_version: "1.6.5" borg_source_directories: - "/home/yunohost.backup" borg_repository: "/data/backup/borg_repository" diff --git a/roles/ynh_backup/tasks/borgbackup.yml b/roles/ynh_backup/tasks/borgbackup.yml index 3da4245..62a674c 100644 --- a/roles/ynh_backup/tasks/borgbackup.yml +++ b/roles/ynh_backup/tasks/borgbackup.yml @@ -31,13 +31,22 @@ - borg - backup -- name: run BorgBackup role +- name: Run BorgBackup role ansible.builtin.import_role: name: m3nu.ansible_role_borgbackup tags: - backup - borg +- name: Install specific version of Borgmatic + ansible.builtin.pip: + name: "borgmatic" + version: "{{ borgmatic_version }}" + virtualenv: /opt/borgmatic + tags: + - backup + - borg + - name: Create backup folder for BorgBackup repository ansible.builtin.file: path: "{{ borg_repository }}"