]> gitweb.hamatoma.de Git - ansknife.git/commitdiff
sys_fetch.yaml
authorHamatoma <author@hamatoma.de>
Sat, 23 Aug 2025 17:37:04 +0000 (19:37 +0200)
committerHamatoma <author@hamatoma.de>
Sat, 23 Aug 2025 17:37:04 +0000 (19:37 +0200)
playbooks.templates/sys_fetch.yaml
tasks.templates/t_sys_fetch_directory.yaml
tasks.templates/t_sys_fetch_file.yaml

index b3ea245f478325698a589e5d36e679b0c9ac540f..f4dec2402adb6fc7a013c104cf5e92a489b69d60 100644 (file)
       sourceFile: "{{ item.source }}"
       targetFile: "{{ item.target }}"
     with_items: "{{ sys_fetch_files }}"
+    when: false
   - name: Fetch the directories
     ansible.builtin.include_tasks: ../tasks/t_sys_fetch_directory.yaml
     vars:
       sourceDir: "{{ item.source }}"
       targetDir: "{{ item.target }}"
     with_items: "{{ sys_fetch_directories }}"
-    when: false
+    when: true
     
index f74c8f2991a724caad1a0cced6aea75315bbcf88..797ec5c975b09dbdc4aa81283cf426a85350efa8 100644 (file)
@@ -14,6 +14,8 @@
 - name: Fetches the files
   ansible.builtin.include_tasks: t_sys_fetch_file.yaml
   vars:
-    sourceFile: "{{ item }}"
-    targetFile: "../{{ targetDir }}/{{ item }}"
-  with_items: "{{ fileList }}"
+    sourceFile: "{{ fetchItem }}"
+    targetFile: "{{ targetDir }}/{{ fetchItem | basename }}"
+  loop: "{{ fileList }}"
+  loop_control:
+    loop_var: fetchItem
index 6cea0d8109b97492090825c4257a4a6f258a8f71..ef39f2d221a6b3d77956073b5c507c760045d314 100644 (file)
@@ -2,9 +2,12 @@
 # needed facts (variables):
 # - sourceFile: the full path of the remote file
 # - targetFile: the relative path of the backup file
+- name: Display the input parameters
+  debug:
+    msg: "src: {{ sourceFile }} trg: {{ targetFile }} {{ targetFile | dirname }}/meta"
 - name: Ensure target directory exists
   ansible.builtin.file:
-    path: "../{{ targetFile | dirname }}/meta"
+    path: "{{ targetFile | dirname }}/meta"
     state: directory
     mode: "0755"
     recurse: true