How to download a s3 folder using playbook

Can anyone help with this?
I am trying to download a s3folder using ansible playbook.

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.

Can you pls provide an example playbook

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 }}”

Where do you specify s3 url?
I have used a synchronized module but it throws errors as below.

Can you post the actual text instead of an (unreadable) screenshot?