# Ansible s3\_sync to upload multiple files

**URL:** <https://forum.ansible.com/t/ansible-s3-sync-to-upload-multiple-files/29436>\
**Category:** Ansible Project\
**Created:** [January 14, 2019, 5:04pm UTC](https://forum.ansible.com/t/ansible-s3-sync-to-upload-multiple-files/29436 "2019-01-14T17:04:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kishore\_Ponniah](https://avatars.discourse-cdn.com/v4/letter/k/74df32/32.png) [@Kishore\_Ponniah](https://forum.ansible.com/u/Kishore_Ponniah)\
**Post date:** [January 14, 2019, 5:04pm UTC](https://forum.ansible.com/t/ansible-s3-sync-to-upload-multiple-files/29436/1 "2019-01-14T17:04:44Z")

</div>

Hi All,

I am trying to upload multiple yaml cloudformation templates to a s3 bucket using s3\_sync. I have created a task in the playbook, looks like the tasks completed successfully but the file is not uploaded. Can someone please advise whether s3\_sync is the proper method? If yes, can someone please help me identify what I have missed. Please find my playbook below:

**Playbook**

- name: upload files rxgt-ps-cross-account-s3-sync  
s3\_sync:  
region: “{{ account\_config.1 }}”  
aws\_access\_key: “{{ account\_config.0.sts\_creds.access\_key }}”  
aws\_secret\_key: “{{ account\_config.0.sts\_creds.secret\_key }}”  
security\_token: “{{ account\_config.0.sts\_creds.session\_token }}”  
bucket: “{{ account\_config.0.account\_config.stacks[‘rxgt-ps-cross-account-s3-sync’].params.bucket }}”  
file\_root: “{{ account\_config.0.account\_config.stacks[‘rxgt-ps-cross-account-s3-sync’].params.file\_root }}”  
mode: “{{ account\_config.0.account\_config.stacks[‘rxgt-ps-cross-account-s3-sync’].params.mode }}”  
file\_change\_strategy: “{{ account\_config.0.account\_config.stacks[‘rxgt-ps-cross-account-s3-sync’].params.file\_change\_strategy }}”  
permission: “{{ account\_config.0.account\_config.stacks[‘rxgt-ps-cross-account-s3-sync’].params.permission }}”  
loop: “{{ assumed\_roles\_with\_account\_config.results|subelements(‘account\_config.regions’, skip\_missing=True) }}”  
loop\_control:  
loop\_var: account\_config  
label: “{{ account\_config.0.account\_config.account\_alias }}:{{ account\_config.1 }}”  
tags:  
rxgt-ps-identity-stack-deploy

**Account\_config file**

stacks:  
rxgt-ps-cross-account-s3-sync:  
params:  
bucket: xxx-xx-xxxxxxxxxxx-eu-west-1-xxxxxxxxxx  
file\_root: /xxx-xxxx-xxxxxplatform/ansible/files/  
mode: push  
file\_change\_strategy: date\_size  
permission: public-read

---

<div class="post-metadata">

**Author:** ![Kishore\_Ponniah](https://avatars.discourse-cdn.com/v4/letter/k/74df32/32.png) [@Kishore\_Ponniah](https://forum.ansible.com/u/Kishore_Ponniah)\
**Post date:** [January 15, 2019, 4:44pm UTC](https://forum.ansible.com/t/ansible-s3-sync-to-upload-multiple-files/29436/2 "2019-01-15T16:44:34Z")

</div>

Hi everyone,

I tried to debug s3\_sync but one thing I noticed is s3\_sync module does not have a destination path. It only has file\_root and I ran this command from the source path “aws s3 sync . s3://bucketname/xxxx/test/”, it uploaded all the files to the destination. Then after I ran the playbook it completed successfully. Experts please advise if I miss something here.

Thanks  
Kishore

---

<div class="post-metadata">

**Author:** ![Kishore\_Ponniah](https://avatars.discourse-cdn.com/v4/letter/k/74df32/32.png) [@Kishore\_Ponniah](https://forum.ansible.com/u/Kishore_Ponniah)\
**Post date:** [January 22, 2019, 12:05pm UTC](https://forum.ansible.com/t/ansible-s3-sync-to-upload-multiple-files/29436/3 "2019-01-22T12:05:04Z")

</div>

This has been resolved by adding a new task for the cross account role to assume from the same account and updated the account config with local account parameters.
