s3_sync parameter file_change_strategy: date_size does not appear to work

13 views
Skip to first unread message

Kane Consulting Group

unread,
Apr 28, 2019, 10:33:58 PM4/28/19
to Ansible Project
So, I am trying to synchronize files to Amazon S3 using the s3_sync module.  The playbook works properly, with the exception of the file_change_strategy parameter date_size.  It seems to ignore files with same size, but different (more recent) dates.  Here is my playbook:

---
- name: backup
  hosts: all
  gather_facts: no
  become: yes

- name: sync all files to Amazon S3
      vars:
        ansible_python_interpreter: /usr/bin/python3
      s3_sync:
        aws_access_key: "{{ key }}"
        aws_secret_key: "{{ secret }}"
        region: us-east-1
        bucket: "{{ s3bucket }}"
        file_root: "/path/{{ mylocation }}/folder"
        key_prefix: "{{ keyprefix }}/"
        file_change_strategy: date_size
        permission: bucket-owner-full-control
        exclude: "*.txt" # sync all files except for txt

I have verified the file(s) using touch/stat to make sure modified dates are newer than the file stored on Amazon S3.

The file(s) are created by a backup process.  Since the source file has not changed, the resulting size of the backup file(s) is the same.  The timestamp(s) are updated after each backup.

I have also removed the exclude parameter to see if that had any impact on the results.  There was no change.

When I alter the file_change_strategy to "force", the newer file uploads to Amazon S3.

Bug? or am I missing something???

Kane Consulting Group

unread,
Apr 29, 2019, 6:02:33 PM4/29/19
to Ansible Project
So, after posting this question, I found a bug report on the same issue:  https://github.com/ansible/ansible/issues/54076

Posting this answer for others.
Reply all
Reply to author
Forward
0 new messages