Include tasks based on OS distribution

Hi,

I have some roles that are specific for some OS family and I’m using the include keyword to include a file when ansible_os_family matches what I want.
The problem with this approach is that when is not the family I want it skips but at the end the user that runs this can think that everything was done.

I want to know what’s the best approach for this, thinking that I also need to tell the user (even fail the task in question) based on the OS being different that what it should be.

Thanks,
Bruno

If you want to fail the assert module is a good candidate
https://docs.ansible.com/ansible/latest/modules/assert_module.html

Hi Kai,

Thanks for the answer, gonna give it a try.

Thanks,
Bruno