title: Ansible conditions with sequence order (A-Z)
body: <p>I am using AWX and we are using CMDB inventory which contains hell of a information per hosts:  I need help in sorting this &quot;ptseq: A&quot; (order is A-Z), so A will go first then B, then C and D. or reverse order will also help.</p>
  <pre><code>---
  all:
    children:
      no_dns:
        hosts: {}
      no_fqdn:
        hosts: {}
    hosts:
      actualhostname1:
        pd: '2022-01-03'
        pt: '02:00'
        ptt '16:00'
        env: 'PRD'
        hap: null
        ptseq: A
        pwin: '01'
      actualhostname2: 
        pd: '2022-03-12'
        pt: '02:00'
        ptt '16:00'
        env: 'QA'
        hap: null
        ptseq: A
        pwin: '01'
      actualhostname3: 
        pd: '2022-02-22'
        pt: '02:00'
        ptt '16:00'
        env: 'Dev'
        hap: null
        ptseq: A
        pwin: '01'
  </code></pre>
  <p>My requirement consists of many conditions (all conditions MUST met).</p>
  <p>pd, pt, env, ptseq (order) as  per inventory file, when conditions are met then run it on inventory_hostname in groups['hosts']</p>
  <pre><code>When:
    - inventory_pd == ansible_date_time.date and (inventory_pt == ansible_date_time.time or inventory_pt == '16:00')
    - inventory_env == 'PRD' or inventory_env=='DEV' or inventory_env=='NP'  
    - inventory_hostname in groups['hosts']
    - inventory_ptseq [A,B,C,D,E,F] ---&gt; This is where i need help...
  </code></pre>
  <p>Order must be (A-Z), so we can do things on ptseq Host A, then B, then C then D and so on and so forth until inventory_pd matching with ansible today's date (ansible_date_time.date)</p>
  <p>Can somebody please help me complete this logic?</p>