Synchronize between Remote hosts

212 views
Skip to first unread message

sve...@oration.com

unread,
Dec 14, 2015, 10:37:02 PM12/14/15
to Ansible Project
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
################
How Can i make this work

Paul Markham

unread,
Dec 14, 2015, 10:59:31 PM12/14/15
to Ansible Project
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" 
Reply all
Reply to author
Forward
0 new messages