Synchronize between Remote hosts

I am trying to synchronize data between remote hosts using the synchroni module.

HOST A-- Ansible Control Node
HOST B- Host with Data or Source of the data that needs to be copied
HOST C- Destination host where data needs to be copied

I can run the command below on HOSTB and execute it succesfully

rsync -avz --perms --chmod=777 -e “ssh -i privatekey.pem” Table ubuntu@HOSTC:/tmp

I have the following setup in a playbook and it gives me the error below when I am running the following playbook
msg: unsupported parameter for module: ’ -avz --perms --chmod

  • hosts: HOSTB
    user: ubuntu
    sudo: true
    vars_files:
  • vars/vars.yml
    tasks:
  • name: Synchronize files from Source to dest
    synchronize: src={{ export_directory }} dest={{ upload_directory }} mode=push rsync_opts= ‘-avz --perms --chmod=777 -e “ssh -i {{ key_directory }}/{{ key }}”’
    delegate_to: HOSTB

According to the documentation, rsync_opts needs to be an array, not a string. The last example in the documentation shows this:

synchronize:
    src: /tmp/helloworld
    dest: /var/www/helloword
    rsync_opts:
      - "--no-motd"
      - "--exclude=.git"