- set_fact: defaultfile: group: root owner: root mode: "0700" state: present content: ~ template: ~ template_vars: {} - set_fact: file: "{{ defaultfile|combine(item.value|d({}), {'path': item.key} ) }}" - name: create file/folder when: - not file.content - not file.template file: path: "{{ file.path }}" group: "{{ file.group }}" owner: "{{ file.owner }}" mode: "{{ file.mode }}" state: "{{ file.state }}"