title: Ansible looping through values specified in a file
body: <p>Trying to get a hang of ansible loops as a beginner. I've got a role for setting up multiple users with their respective attributes. I can loop through the values successfully when the values are specified within the task file but struggling to call the values if they are kept in a different file. </p>
  
  <p>Content of "/roles/myusers/tasks/useradd.yml</p>
  
  <pre><code>- name: Add serveral users
    user:
      name: "{{ item.name }}"
      group: sftp
      groups: sftp
      state: present
      uid: "{{ item.uid }}"
    loop:
      {{ users }}
  </code></pre>
  
  <p>Content of "/roles/myusers/vars/main.yml"</p>
  
  <pre><code>---
  users:
    - { name: 'testuser1', uid: '691' }
    - { name: 'testuser2', uid: '692' }```
  </code></pre>
  
  <p>Content of Content of "/roles/myusers/tasks/main.yml"</p>
  
  <pre><code>---
  - import_tasks: useradd.yml
  </code></pre>
  
  <p>Please can someone shed some light? My understanding is that when the values are kept in /var/main.yml file there doesnt appear to be a reason to use "include_vars", "include" and etc..? Admit that I haven't spent enough time going through the documentation. Looks to be it isn't the easiest thing to read. TIA guys.</p>