Hi,

I'm struggling to solve a classical problem : building a multi-OS role 
without spawning unnecessary skipped statements. I've already read a lot of 
discussions on the subject (Dynamic 'include:' lines? 
<https://groups.google.com/forum/#!topic/ansible-project/PzA4Vb9SEmk>, 
Conditional 
Include Question 
<https://groups.google.com/forum/#!msg/ansible-project/NBnq9vUZSFQ/L3kLFiwQEM0J>
, Roles with multiple OS versions 
<http://grokbase.com/t/gg/ansible-project/148szr25xy/roles-with-multiple-os-versions>...),
 
but I find no satisfying solution :

   - *task include* with "when" statement does not really performs a 
   conditional include, since it instantiates all tasks in the included file 
   with an added "when" statement, so at runtime we get a lot of unnecessary 
   skipped messages.
   - *task include* file name is evaluated at parsing level, before any 
   host is even contacted, so we can't use the same trick as with 
   *include_vars*.
   - the officially recommended solution, *group_by*, seems fine, but since 
   we can't restrict a task to specific hosts, we can't use it in a role. It's 
   designed to be used in a playbook, so it's not a real solution for a 
   multi-OS role.

I think I've listed every alternative, but I may be missing something. If 
that's not the case, would it be possible to extend the task include 
statement to handle properly the when clause at runtime, depending on each 
host ?

Thanks for your help,

Julien

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e7bc914d-df02-4f92-95e5-f9fd8420ef55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to