--- - name: "Copy templates : {{ context }}" tags: - config ansible.builtin.template: src: "{{ item.src }}" dest: "{{ home }}/{{ item.path | regex_replace('\\.j2$', '') }}" mode: "{{ item.mode }}" with_community.general.filetree: - ../templates/{{ context }} loop_control: label: "{{ item.path }}" when: item.state == 'file' - name: "Copy config : {{ context }}" tags: - config ansible.builtin.copy: src: "{{ item.src }}" dest: "{{ home }}/{{ item.path }}" mode: "{{ item.mode }}" with_community.general.filetree: - ../files/{{ context }} loop_control: label: "{{ item.path }}" when: item.state == 'file'