Due to the fact that we cannot run loop on block with Ansible, therefore I have to do include_tasks
in the loop where the referenced file contains more than 1 task.
What if I need to dynamically end the loop earlier (lets say 5 iterations instead of 10 as defined by the loop:
statements). trying to use when:
condition but that only take in pre-defined/statically defined variables, if I have to update the variable that will be evaluated in when:
for each iteration, I have to do register:
or set_fact
in a task before that, which is not possible when the loop task is running…
Also in the included_tasks
I can set meta: end_play
to end the loop and the play execution but that is not what I want, the play should continue after the loop.