Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 1b9b1e13 authored by Arthur BOUDREAULT's avatar Arthur BOUDREAULT
Browse files

refactor: conditional for backup directory

parent 4bd347af
No related branches found
No related tags found
1 merge request!19Draft: Resolve "backup all installed apps and system"
Pipeline #3156 passed with warnings
...@@ -65,9 +65,9 @@ ynh_apps: null ...@@ -65,9 +65,9 @@ ynh_apps: null
# Variables for backup # Variables for backup
# ynh_backup: # ynh_backup:
# directory: "/data/backup" # directory: "/data/backup" #If you want default folder, just leave it empty
# scheduled: "true" # scheduled: "true"
# scheduled_hour: 3 # scheduled_hour: 3
# scheduled_minute: "*" # scheduled_minute: "0"
# scheduled_weekday: "*" # scheduled_weekday: "*"
# scheduled_month: "*" # scheduled_month: "*"
...@@ -18,15 +18,23 @@ ...@@ -18,15 +18,23 @@
# # # #
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
- name: Create cron tasks under /etc/cron.d to perform auto-backup of apps - name: Create cron task to perform YNH apps backup
ansible.builtin.cron: ansible.builtin.cron:
name: "auto-backup {{ item.label }} to {{ ynh_backup.directory }}/{{ item.link }}" name: "auto-backup apps to {{ ynh_backup.directory | default('/home/yunohost.backup/archives') }}"
month: "{{ ynh_backup.scheduled_month | default('*') }}" month: "{{ ynh_backup.scheduled_month | default('*') }}"
weekday: "{{ ynh_backup.scheduled_weekday | default('*') }}" weekday: "{{ ynh_backup.scheduled_weekday | default('*') }}"
hour: "{{ ynh_backup.scheduled_hour | default('*') }}" hour: "{{ ynh_backup.scheduled_hour | default('1') }}"
minute: "{{ ynh_backup.scheduled_minute | default('*') }}" minute: "{{ ynh_backup.scheduled_minute | default('0') }}"
user: root user: root
job: "yunohost backup create --apps {{ item.link }} job: "yunohost backup create --apps
-o {{ ynh_backup.directory }}/{{ item.link }}" {% if ynh_backup.directory is string %}
cron_file: ynh_backup_apps -o {{ ynh_backup.directory }} -n {{ ynh_backup.name }}
loop: "{{ ynh_apps }}" {% else %}
-n {{ ynh_backup.name }}
{% endif %}"
cron_file: cron_task_ynh_apps_backup
- name: restart cron config ##Is it useful to restart cron after config change?
ansible.builtin.service:
name: cron
state: restart
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment