--- - name: import a task hosts: containers gather_facts: false tasks: - debug: msg: "{{ item }}" loop: "{{ selected_containers }}" - debug: msg: "{{ item }}" loop: "{{ selected_host }}"