- name: "mkt-scripts: create dir" file: path: /etc/maketank state: directory mode: '0755' - name: "mkt-scripts: create-remote-dirs" file: path: /etc/maketank/{{item.path}} state: directory mode: '0775' with_filetree: files/ when: item.state == 'directory' - name: "mkt-scripts: copy-files" copy: src: "{{item.src}}" dest: /etc/maketank/{{item.path}} mode: '0744' with_filetree: files/ # combinations of 'is' and 'is not' can be used below. when: item.state == 'file' and item.path is not search("*.bak")