How to download a s3 folder using playbook

35 views
Skip to first unread message

surabhy vaishakh

unread,
Sep 9, 2020, 2:16:57 AM9/9/20
to ansible...@googlegroups.com
Can anyone help with this?
I am trying to download a s3folder using ansible playbook. 

Tom Black

unread,
Sep 9, 2020, 2:34:37 AM9/9/20
to ansible...@googlegroups.com
surabhy vaishakh wrote:
> Can anyone help with this?
> I am trying to download a s3folder using ansible playbook.

You should be able to use s3 SDK for this stuff.

aws s3 cp s3://Bucket/Folder LocalFolder --recursive


regards.

surabhy vaishakh

unread,
Sep 9, 2020, 2:39:41 AM9/9/20
to ansible...@googlegroups.com
Can you pls provide an example playbook

--
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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/297ce356-b939-d845-41dc-976d219c57e2%40gmail.com.

Mauro Ferrigno

unread,
Sep 9, 2020, 3:07:01 AM9/9/20
to ansible...@googlegroups.com
Hello,
I used aws_s3 and file module to  pull s3 bucket to local with folders and subfolders and files related, but please next time show your stuff and ask where you are in stuck 

- name: get s3_bucket_items
aws_s3:
mode: list
bucket: "{{ automation_bucket }}"
register: s3_bucket_items

- name: "Create inventory folder recursively"
file:
path: "{{ item| dirname }}"
state: directory
recurse: true
with_items: "{{ s3_bucket_items.s3_keys }}"

- name: "Download files from S3"
aws_s3:
mode: get
bucket: "{{ automation_bucket }}"
object: "{{ item }}"
dest: "{{ item| dirname }}/{{ item|basename }}"
with_items: "{{ s3_bucket_items.s3_keys }}"


Il giorno mer 9 set 2020 alle ore 08:16 surabhy vaishakh <surabhy...@gmail.com> ha scritto:
Can anyone help with this?
I am trying to download a s3folder using ansible playbook. 

--
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 ansible-proje...@googlegroups.com.

surabhy vaishakh

unread,
Sep 9, 2020, 3:24:12 AM9/9/20
to ansible...@googlegroups.com
Where do you specify s3 url? 
I have used a synchronized module but it throws errors as below. 
image.png




Dick Visser

unread,
Sep 9, 2020, 5:18:21 AM9/9/20
to ansible...@googlegroups.com
Can you post the actual text instead of an (unreadable) screenshot?


On Wed, 9 Sep 2020 at 09:24, surabhy vaishakh <surabhy...@gmail.com> wrote:
>
> Where do you specify s3 url?
> I have used a synchronized module but it throws errors as below.
>
>
>
>
>
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CABB7rDfzhghGATyo77ixc-y8HJpYyZK_XMXQgA1x3m_8-bHRhA%40mail.gmail.com.



--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT
Reply all
Reply to author
Forward
0 new messages