--- - name: Include tasks only if one of the files exist, otherwise skip the task include_tasks: '{{ item }}' vars: params: files: - '{{ ansible_os_family }}.yml' loop: "{{ q('first_found', params, errors='ignore') }}"