Include tasks based on OS distribution

23 views
Skip to first unread message

Bruno Cochofel

unread,
Jul 12, 2019, 6:12:21 AM7/12/19
to Ansible Project
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

Kai Stian Olstad

unread,
Jul 12, 2019, 10:54:33 AM7/12/19
to ansible...@googlegroups.com
If you want to fail the assert module is a good candidate
https://docs.ansible.com/ansible/latest/modules/assert_module.html

--
Kai Stian Olstad

Bruno Cochofel

unread,
Jul 13, 2019, 6:08:18 AM7/13/19
to Ansible Project
Hi Kai,

Thanks for the answer, gonna give it a try.

Thanks,
Bruno
Reply all
Reply to author
Forward
0 new messages