--- - name: Using only loop keyword to iterate over list stored in another file hosts: nodes vars_files: /tmp/list.yml tasks: - name: Group adding group: name: "{{ item }}" state: present loop: - group1 - group2 - group3 - name: User Adding user: name: "{{ item[0] }}" groups: "{{ item[1] }}" append: yes with_nested: - { Ram, Sham, Hanuman } - { group1, group2, group3 } ...