diff --git a/roles/ynh_backup/README-FR.md b/roles/ynh_backup/README-FR.md index 3a383e8cfae39fb28641f5be5f1386a9d1f6be86..224788a75a5fcb75a1f1a53bd8e9a7667a577a4d 100644 --- a/roles/ynh_backup/README-FR.md +++ b/roles/ynh_backup/README-FR.md @@ -34,11 +34,12 @@ ynh_backup: dest_script: "/usr/bin" ``` -- `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 : <https://crontab.guru/>. -- `ynh_backup.system` : **obligatoire**. Activez la sauvegarde du système YunoHost en mettant la valeur à `True`. -- `ynh_backup.apps` : **obligatoire**. Activez la sauvegarde des applications YunoHost en mettant la valeur à `True`. +- `ynh_backup.scheduled` : active la fonctionnalité de sauvegarde des applications YunoHost en mettant la valeur à `True`. +- `ynh_backup.directory` : le dossier de sauvegarde par défaut est `/home/yunohost.backup/archives`. Vous pouvez 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 à 3 heure du matin. Pour plus d'informations concernant les réglages horaires cron, cet outil peut être utile : <https://crontab.guru/>. +- `ynh_backup.system` : Désactivez la sauvegarde du système YunoHost en mettant la valeur à `False`, la valeur par défaut est à `True`. +- `ynh_backup.apps` : Désactivez la sauvegarde des applications YunoHost en mettant la valeur à `False`, la valeur par défaut est à `True`. +- âš ï¸ Attention, à partir du moment où vous activez la fonctionnalité de sauvegarde locale `ynh_backup.scheduled`, vous ne pouvez pas désactiver les sauvegardes système **et** applications. Si vous mettez `ynh_backup.system` **et** `ynh_backup.apps` à `False`, le rôle tombera en erreur. ### Sauvegardes distantes avec BorgBackup diff --git a/roles/ynh_backup/README.md b/roles/ynh_backup/README.md index 2c332bd2816600b3c2757eadafed3d5917548588..2fe92eda346cd999c2de8cb9770520b2e23d6776 100644 --- a/roles/ynh_backup/README.md +++ b/roles/ynh_backup/README.md @@ -34,11 +34,12 @@ ynh_backup: dest_script: "/usr/bin" ``` -- `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: <https://crontab.guru/>. -- `ynh_backup.system`: **mandatory**. Enables automatic backup of the YunoHost system by setting the value to `True`. -- `ynh_backup.apps`: **mandatory**. Enables automatic backup of YunoHost applications by setting the value to `True`. +- `ynh_backup.scheduled`: Enable the YunoHost applications backup feature by setting the value to `True`. +- `ynh_backup.directory`: the default backup folder is `/home/yunohost.backup/archives`. 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 3am. For more information about cron time settings, this tool can be useful: <https://crontab.guru/>. +- `ynh_backup.system`: Disable YunoHost system backup by setting the value to `False`, the default value is `True`. +- `ynh_backup.apps`: Disable backup of YunoHost applications by setting the value to `False`, the default is `True`. +- âš ï¸ Beware, once you enable the local backup feature `ynh_backup.scheduled`, you cannot disable system **and** application backups. If you set `ynh_backup.system` **and** `ynh_backup.apps` to `False`, the role will fail. ### remote backups with YunoHost BorgBackup diff --git a/roles/ynh_backup/defaults/main.yml b/roles/ynh_backup/defaults/main.yml index 99c2dc45cb78c7f4aaf1a3794863b18345d439ea..dd9f812320613f741cc85edb90a5daf830f84388 100644 --- a/roles/ynh_backup/defaults/main.yml +++ b/roles/ynh_backup/defaults/main.yml @@ -21,13 +21,13 @@ # Variables for local YunoHost backups ynh_backup: scheduled: False - # directory: "/data/backup" - # scheduled_hour: 3 - # scheduled_minute: "0" - # scheduled_weekday: "*" - # scheduled_month: "*" - # system: True - # apps: True + directory: "/data/backup" + scheduled_hour: "3" + scheduled_minute: "0" + scheduled_weekday: "*" + scheduled_month: "*" + system: True + apps: True # Variables for YunoHost BorgBackup ynh_borg_backup_scheduled: False diff --git a/roles/ynh_backup/tasks/backup.yml b/roles/ynh_backup/tasks/backup.yml index 688d36a98cac0fd6e892ed021788cfe341fdee6f..9dbc153c863bab0fb25c523b89f814fe926383e3 100644 --- a/roles/ynh_backup/tasks/backup.yml +++ b/roles/ynh_backup/tasks/backup.yml @@ -17,6 +17,11 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # # # #-----------------------------------------------------------------------------# +- name: Fail if variables are not used correctly + ansible.builtin.fail: + msg: You need to define variable ynh_backup.apps and / or ynh_backup.system to True + when: ynh_backup.apps is false and ynh_backup.system is false + tags: backup - name: Create backup folder if doesn't already exist ansible.builtin.file: