include_tasks accepts a when: clause. For more details, see:
include_tasks
when:
when - Conditional Task Execution
when
Difference between include and import