title: Execute ansible include_tasks until a certain condition is met (kind of while until loop)
body: <p>I want to execute an include tasks list until a certain condition is met, I do not have a fixed loop but execution depends upon a condition.</p>
  <p>A sample play below</p>
  <p>Tasks list playbook
  <code>tasks.yml</code></p>
  <pre><code>---
  
  - name: &quot;inc test-var {{ test_var }}&quot;
    set_fact:
      test_var: &quot;{{ test_var | int + 1  }} &quot;
  </code></pre>
  <p>parent playbook <code>parent.yml</code></p>
  <pre><code>---
  
  - hosts: all
    gather_facts: no
  
    tasks:
      - set_fact:
          test_var: '1'
          req_var: '4'
  
      - name: &quot;Test multi run of task&quot;
        include_tasks: ./includes/tasks.yml
        register: versions_result
        until: test_var is version(req_var, '&lt;')
        retries: 5
  </code></pre>
  <p>here I am expecting <code>parent.yml</code> tasks to run multiple times but it only run once.
  Could some one point out what I am doing wrong and how to run a task multiple times until a condition is met.</p>
  <p>Cheers,</p>