title: Ansible read variable from external file
body: <p>I am storing all variables in json format in a external file and trying to read in the playbook
  Here's an example
  file </p>
  
  <pre><code>{out_file: exp_app_20.xml,  control_file: export_control.xml  }
  {out_file: exp_app_21.xml,  control_file: export_control.xml }
  </code></pre>
  
  <p>Now when I am trying to read the variables <strong>out_file</strong> and <strong>control_file</strong> I am not able to find a suitable way to read it .
  I have tried with_items and with_lines but no luck </p>
  
  <pre><code>- name: searching for text file
  
    gather_facts: false
    vars:
     host_tgt: TGT
  
    hosts: "{{ host_tgt }}"
    tasks:
  
  
  
    - name: get the file contents
      shell: cat /dir/export.prop
      register: my_items
  
    - debug:
        var: my_items
  
    - name: Export 
      shell: echo {{ item.out_file }} **---error**
  
      with_items: my_items.stdout_lines
  
      register: find_output
  
    - debug:
        var: find_output
  </code></pre>
  
  <p>Any suggestions appreciated</p>