--- # tasks file for mount - name: Set up mounts if variable is defined block: - include_tasks: ext4.yml loop: "{{ mounts }}" when: item.type == "ext4" - include_tasks: nfs.yml loop: "{{ mounts }}" when: item.type == "nfs" - include_tasks: sshfs.yml loop: "{{ mounts }}" when: item.type == "sshfs" when: mounts is defined