---
files: "{{ dir }}_files"---
onedir_files:
- abc1
- abc2
- abc3
twodir_files:
- xyz1
- xyz2
threedir_files:
- one
- two
- three---
- name: Download Properties Files!
get_url:
url: "{{ url }}/{{ dir }}/{{ item }}"
dest: "{{ dest_dir }}/"
with_items: "{{ files }}"failed: [target_host] (item=onedir_files) => {"changed": false, "dest": "/some/target/path", "gid": 0, "group": "root", "item": "onedir_files", "mode": "0755", "msg": "Request failed", "owner": "root", "response": "HTTP Error 404: org.tmatesoft.svn.core.SVNException: svn: E175007: Path '/some/path/", "secontext": "unconfined_u:object_r:default_t:s0", "size": 4096, "state": "directory", "status_code": 404, "uid": 0, "url": "https://someurl/one/onedir_files"}---
- name: Download Properties Files!
get_url:
url: "{{ url }}/{{ dir }}/{{ item }}"
dest: "{{ dest_dir }}/"
with_items:
- files: "{{ lookup('vars', dir ~'_files') }}"
failed: [sometarget-machine.com] (item={u'files': [u'abc1', u'abc2', u'abc3']}) => {"changed": false, "dest": "/some/path/onedir", "gid": 0, "group": "root", "item": {"files": ["abc1", "abc2", "abc3"]}, "mode": "0755", "msg": "Request failed", "owner": "root", "response": "HTTP Error 400: Bad request", "secontext": "unconfined_u:object_r:default_t:s0", "size": 4096, "state": "directory", "status_code": 400, "uid": 0, "url": "https://targetURL/{u'files': [u'abc1', u'abc2', u'abc3']}"}---
- hosts: sametarget
gather_facts: no
become: yes
tasks:
- name: Download Files
get_url:
url: https://targetURL{{ item }}
dest: some/target/path
with_items:
- abc1
- abc2
- abc3