title: ansible select first found from dict
body: <p>I have the following ansible playbook. fX is for framework version 1,2 or 3. When a file has a version >= fX it should select that framework version using a last found type method, so we don't get multiple results.</p>
  
  <p>file_version >= 1.2.0 should give f2 for example, and file_version >= 2.2.0 should result in f3. </p>
  
  <pre><code>- name: select version
    hosts: all
    connection: local
    become: false
    vars:
      version:
        f3: '2.2.0'
        f2: '1.2.0'
        f1: '1.0.0'
    tasks:
      - name: debug loop
        debug:
          msg: "{% for F in version %}{% if file_version | version_compare(version[F],'&gt;=') %}{{ F }} {% endif %}{% endfor %}"
  
  
  ansible-playbook case.yml -i 127.0.0.1, -vv -e file_version='1.5.0'
  </code></pre>
  
  <p>Ansible should decide for me, that I should be using framework version 1.2.0 or {{ f2 }}. But of course this yields two matches</p>
  
  <pre><code>f1 f2
  </code></pre>
  
  <p>How can I pull out the last found version? Is there a more elegant way to do this?</p>