Reputation: 2398
What do I have: two S3 buckets named "s3_sync-ansible-test-1" and "s3_sync-ansible-test-2".
Buckets structure:
s3_sync-ansible-test-1
|-folder_1
|-file_1.txt
|-file_2.txt
|-folder_2
|-file_2.txt
s3_sync-ansible-test-2
bucket is empty.
What do I want to do: sync everything between s3_sync-ansible-test-1
and s3_sync-ansible-test-2
.
What did I tried:
- name: "Sync S3 buckets"
register: sync_s3
s3_sync:
bucket: s3_sync-ansible-test-2
file_root: /s3_sync-ansible-test-1
- debug:
msg: "{{ sync_s3 }}"
Debug output is
"msg": {
"changed": false,
"failed": false,
"filelist_actionable": [],
"filelist_initial": [],
"filelist_local_etag": [],
"filelist_s3": [],
"filelist_typed": [],
"uploads": []
}
At the same time, manual command
aws s3 sync s3://s3_sync-ansible-test-1 s3://s3_sync-ansible-test-2
works as expected.
I've also tried to change file_root
to s3://s3_sync-ansible-test-2
without success.
What could be wrong?
Upvotes: 0
Views: 378
Reputation: 74
As the document of s3_sync described:
file_root: / required File/directory path for synchronization.This is a local path. This root path is scrubbed from the key name, so subdirectories will remain as keys
the file_root is a local path. which means it can't be a s3 bucket.
if you really want to using this module , you can use s3fs mount s3 bucket to your instance, then using ansible s3_sync to sync it.
Upvotes: 1