You can do this in 2 steps:
1.
*s3: *
*  bucket: "{{bucket_name}}"*
*  prefix:   "{{path_to_download}}" *
*  s3_url:  "{{amazon_s3_url}}*
*  mode: list*
*register: s3list*

2.
*s3:*
*  bucket: "{{bucket_name}}"*
*  object:  "{{ item }}" *
*  s3_url:  "{{amazon_s3_url}}*
*  dest:     "{{ destination_dir }}/{{ item|basename }}"*
*  mode:   get*
*with_items: "{{ s3list.s3_keys }}"*


Am Freitag, 20. Dezember 2013 05:16:48 UTC+1 schrieb Rohan Deshpande:
>
> I have a script that downloads stuff from amazon S3
>
> Downloading file works perfectly but in one scenario i want to download 
> whole directory from the bucket.
>
> Ansible seems to require *file name* in object and destination
>
> Is anyone aware of how to do this?
>
> Code to download file from amazon S3
>
>
> *s3: bucket={{bucket_name}} object={{filename_to_download}} 
> dest={{destination_dir}}/{{src_filename}}  s3_url={{amazon_s3_url}} 
> mode=get*
>
> Code I tried to download whole dir (want to download all files in current 
> dir)
>
>
> *s3: bucket={{bucket_name}} object=/resource/current/ 
> dest={{destination_dir}}/current/  s3_url={{amazon_s3_url}} mode=get*i 
> get following error
>
>
>
>
> * IOError: [Errno 21] Is a directory: '/destination/current/'*
> Thanks
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/193a711f-e0f9-442e-bbab-ee34ae5c9a85%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to