Allow to omit hostname directory.
- name: Fetch files
fetch:
src: "{{ item }}"
- dest: "{{ start_dir }}/{{ inventory_hostname }}/"
+ dest: "{{ start_dir }}/{% if not plain_dir %}{{ inventory_hostname }}/{% endif %}"
flat: yes
loop: "{{ files.split(',') }}"
tasks:
- name: Copy files
copy:
- src: "{{ start_dir }}/{{ inventory_hostname }}/{{ item }}"
+ src: "{{ start_dir }}/{% if not plain_dir %}{{ inventory_hostname }}/{% endif %}{{ item }}"
dest: "{{ dest_dir }}/"
owner: "{{ owner | default('root') }}"
group: "{{ group | default('root') }}"