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
- 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
# 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