File names are separated by a comma, no space.
-- name: "Fetch {{ file }}"
+- name: "Fetch files"
hosts: "{{ hosts | default('all') }}"
gather_facts: false
tasks:
- name: Fetch files
fetch:
- src: "{{ file }}"
+ src: "{{ item }}"
dest: "{{ start_dir }}/{{ inventory_hostname }}/"
flat: yes
+ loop: "{{ files.split(',') }}"
-- name: "Push {{ file }}"
+- name: "Push files"
hosts: "{{ hosts | default('all') }}"
become: yes
gather_facts: false
tasks:
- name: Copy files
copy:
- src: "{{ start_dir }}/{{ inventory_hostname }}/{{ file }}"
+ src: "{{ start_dir }}/{{ inventory_hostname }}/{{ item }}"
dest: "{{ dest_dir }}"
owner: "{{ owner | default('root') }}"
group: "{{ group | default('root') }}"
mode: "{{ mode | default('0644') }}"
+ loop: "{{ files.split(',') }}"