I am trying to download the images in the remote sever by executing the below ansible playbook, however I am struck with the following error. Could anyone help me in resolving this issue.
Ansible-playbook:
name: download images from http
hosts: target1
tasks:
- name: download the images
get_url:
url: "{{ item }}"
dest: /home/ubuntu
when: ansible_user== 'ubuntu'
loop: "{{lookup('file', '/home/ubuntu/file.txt')}}"
error:
fatal: [target1]: FAILED! => {"msg": "Invalid data passed to 'loop', it requires a list, got this instead: https://test.s3.eu-central-1.amazonaws.com/gm.mp4\nhttps://test.s3.eu-central-1.amazonaws.com/ge.mp4 Hint: If you passed a list/dict of just one element, try adding wantlist=True to your lookup invocation or use q/query instead of lookup."}
file.txt:
https://test.s3.eu-central-1.amazonaws.com/gm.mp4
https://test.s3.eu-central-1.amazonaws.com/ge.mp4