From 9a9d83bb9d3be909f25ba6069eba4f8bed3eddc1 Mon Sep 17 00:00:00 2001
From: Arthur BOUDREAULT <arthur@lydra.fr>
Date: Thu, 23 Jun 2022 16:38:34 +0200
Subject: [PATCH] refactor(ynh_setup): new task to create backup directory and
 force symlink

---
 roles/ynh_setup/tasks/main.yml | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/roles/ynh_setup/tasks/main.yml b/roles/ynh_setup/tasks/main.yml
index 4198159..9dcb439 100644
--- a/roles/ynh_setup/tasks/main.yml
+++ b/roles/ynh_setup/tasks/main.yml
@@ -35,6 +35,15 @@
     - pkg
     - linux
 
+- name: Create backup directory
+  ansible.builtin.file:
+    path: "/home/yunohost.backup/archives"
+    state: directory
+    mode: "0755"
+  tags:
+    - linux
+  when: ynh_data_dirs_enabled
+
 - name: Create data and config subdirs of Yunohost
   ansible.builtin.file:
     path: "{{ item.path }}"
@@ -48,14 +57,15 @@
 
 - name: Create symbolic links for Yunohost subdirs
   ansible.builtin.file:
-    src: "{{ item.path }}"
-    dest: "{{ item.link }}"
+    src:   "{{ item.path }}"
+    dest:  "{{ item.link }}"
     state: link
+    force: yes
   with_items:
-    - "{{ ynh_data_dirs }}"
+    -      "{{ ynh_data_dirs }}"
   tags:
-    - linux
-  when: ynh_data_dirs_enabled
+    -      linux
+  when:    ynh_data_dirs_enabled
 
 - name: Test if Yunohost is already installed
   ansible.builtin.stat: path=/etc/yunohost/installed
-- 
GitLab