diff --git a/roles/ynh_backup/README-FR.md b/roles/ynh_backup/README-FR.md
index a39d4f8..7d58035 100644
--- a/roles/ynh_backup/README-FR.md
+++ b/roles/ynh_backup/README-FR.md
@@ -28,15 +28,13 @@ ynh_backup:
dest_script: "/usr/bin"
```
-La tâche backup va permettre de sauvegarder les applications Yunohost ainsi que leurs données grâce à la mise en place d'une tâche cron.
+La tâche _backup_ va permettre de sauvegarder les applications Yunohost ainsi que leurs données grâce à la mise en place d'une tâche cron. Cette sauvegarde utilise celle fournie par [Yunohost](https://yunohost.org/fr/backup) et elle est locale au serveur.
- `ynh_backup.scheduled` : active la fonctionnalité de sauvegarde des applications Yunohost, mettez la valeur à `True`.
- `ynh_backup.directory` : le dossier de sauvegarde par défaut est `/home/yunohost.backup/archives` cependant vous pouvez tout à fait choisir de sauvegarder les backups dans un autre dossier grâce à cette variable. Dans ce cas, de manière à pouvoir restaurer les backups depuis l'interface web, Yunohost créé automatiquement un lien symbolique de l'archive créée vers son dossier par défaut.
- `ynh_backup.scheduled_[hour|minute|weekday|month]`: modifie la planification de la tâche cron. Par défaut elle se déclenchera tous les jours de l'année à 1 heure du matin. Pour plus d'informations concernant les réglages horaires cron, cet outil peut être utile : .
- `ynh_backup.system` : est obligatoire. Activez la sauvegarde du système Yunohost en mettant la valeur à `True`.
- `ynh_backup.apps` : est obligatoire. Activez la sauvegarde des applications Yunohost en mettant la valeur à `True`.
-- `src_script`: il s'agit du chemin absolu où le fichier de template se situe sur la machine qui exécute Ansible. Par défaut, il sera stocké dans `templates/ynh_backup.sh.j2`.
-- `dest_script`: il s'agit du répertoire où le fichier de template va être stocké. Par défaut, il sera stocké dans `/usr/local/bin/`. Le script s'appelle `ynh_backup.sh`.
## Dépendances
diff --git a/roles/ynh_backup/README.md b/roles/ynh_backup/README.md
index 91e760a..06904e6 100644
--- a/roles/ynh_backup/README.md
+++ b/roles/ynh_backup/README.md
@@ -28,15 +28,13 @@ ynh_backup:
dest_script: "/usr/bin"
```
-The backup task will allow to backup Yunohost applications and their data by setting up a cron job.
+The _backup_ task will allow to backup Yunohost applications and their data by setting up a cron job. This backup uses the one provided by [Yunohost](https://yunohost.org/fr/backup) and it is local to the server.
- `ynh_backup.scheduled`: to enable the Yunohost applications backup feature, set the value to `True`.
- `ynh_backup.directory`: the default backup folder is `/home/yunohost.backup/archives` however you can choose to save the backups in another folder with this variable. In this case, in order to be able to restore the backups from the web interface, Yunohost automatically creates a symbolic link from the created archive to its default folder.
- `ynh_backup.scheduled_[hour|minute|weekday|month]`: modifies the scheduling of the cron task. By default it will run every day of the year at 1am. For more information about cron time settings, this tool can be useful: .
- `ynh_backup.system` : is mandatory. Enables automatic backup of the Yunohost system by setting the value to `True`.
-- `ynh_backup.apps` : est obligatoire. Enables automatic backup of Yunohost applications by setting the value to `True`.
-- `src_script`: this is the absolute path where the template file is located on the machine running Ansible. By default is will be stored in `templates/ynh_backup.sh.j2`.
-- `dest_script`: this is the directory where the template file will be stored. By default is will be stored in `/usr/local/bin`. The script is named `ynh_backup.sh`.
+- `ynh_backup.apps` : is mandatory. Enables automatic backup of Yunohost applications by setting the value to `True`.
## Dependencies
diff --git a/roles/ynh_backup/defaults/main.yml b/roles/ynh_backup/defaults/main.yml
index 5e8e0dd..27500a4 100644
--- a/roles/ynh_backup/defaults/main.yml
+++ b/roles/ynh_backup/defaults/main.yml
@@ -28,5 +28,3 @@ ynh_backup:
# scheduled_month: "*"
# system: True
# apps: True
- # src_script: "templates/ynh_backup.sh.j2"
- # dest_script: "/usr/local/bin/"
diff --git a/roles/ynh_backup/tasks/backup.yml b/roles/ynh_backup/tasks/backup.yml
index a956b19..1a5b2bb 100644
--- a/roles/ynh_backup/tasks/backup.yml
+++ b/roles/ynh_backup/tasks/backup.yml
@@ -28,14 +28,13 @@
- name: Create backup script
ansible.builtin.template:
- src: "{{ ynh_backup.src_script | default('templates/ynh_backup.sh.j2') }}"
- dest: "{{ ynh_backup.dest_script | default('/usr/local/bin/') }}ynh_backup.sh"
+ src: "{{ ynh_backup_src_script }}"
+ dest: "{{ ynh_backup_dest_script }}"
owner: root
group: root
mode: '0740'
tags:
- backup
- - cron
- name: Create cron task to schedule YNH backup script
ansible.builtin.cron:
@@ -45,7 +44,7 @@
hour: "{{ ynh_backup.scheduled_hour | default('1') }}"
minute: "{{ ynh_backup.scheduled_minute | default('0') }}"
user: root
- job: "{{ ynh_backup.dest_script | default('/usr/local/bin/') }}ynh_backup.sh"
+ job: "{{ ynh_backup_dest_script }}"
cron_file: ynh_backup_cron
tags:
- backup
diff --git a/roles/ynh_backup/vars/main.yml b/roles/ynh_backup/vars/main.yml
new file mode 100644
index 0000000..9fda391
--- /dev/null
+++ b/roles/ynh_backup/vars/main.yml
@@ -0,0 +1,23 @@
+---
+#-----------------------------------------------------------------------------#
+# ansible-yunohost allows to deploy Yunohost using Ansible #
+# Copyright 2021-present Lydra https://www.lydra.fr/ #
+# #
+# this program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# this program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see . #
+# #
+#-----------------------------------------------------------------------------#
+
+# Variables for backup
+ynh_backup_src_script: "templates/ynh_backup.sh.j2"
+ynh_backup_dest_script: "/usr/local/bin/ynh_backup.sh"