# ansible synchronize & vagrant

**URL:** <https://forum.ansible.com/t/ansible-synchronize-vagrant/21609>\
**Category:** Ansible Project\
**Created:** [May 31, 2016, 12:52pm UTC](https://forum.ansible.com/t/ansible-synchronize-vagrant/21609 "2016-05-31T12:52:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bendt\_Alphonse](https://avatars.discourse-cdn.com/v4/letter/b/c5a1d2/32.png) [@Bendt\_Alphonse](https://forum.ansible.com/u/Bendt_Alphonse)\
**Post date:** [May 31, 2016, 12:52pm UTC](https://forum.ansible.com/t/ansible-synchronize-vagrant/21609/1 "2016-05-31T12:52:09Z")

</div>

Hi there,

i am trying to ansible for provisioning of a vagrant box.  
It seems that the synchronize task does not work reliably.  
It seems that rsync targets the host machine instead of the vagrant target machine:

Ansible Task:

- name: sync Jenkins Dockerfile  
synchronize: src=docker/ dest=/tmp/docker-jenkins rsync\_opts=“-vv” rsync\_path="sudo rsync“

the folder ‚docker’ on the host contains some configuration files

output of ansible run:

TASK [jenkins-docker : sync Jenkins Dockerfile] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
task path: /Users/abendt/Projekte/ContinuousDelivery/roles/jenkins-docker/tasks/main.yml:7  
changed: [ci] =\> {“changed”: true, “cmd”: “/opt/local/bin/rsync --delay-updates -F --compress --archive --rsh ‘/usr/bin/ssh -i /Users/abendt/Projekte/ContinuousDelivery/.vagrant/machines/ci/virtualbox/private\_key -S none -o StrictHostKeyChecking=no -o Port=2222’ --rsync-path="sudo rsync" -vv --out-format=‘\<\>%i %n%L’ "/Users/abendt/Projekte/ContinuousDelivery/roles/jenkins-docker/docker/" "/tmp/docker-jenkins"”, “msg”: “building file list … done\ncreated directory /tmp/docker-jenkins\ndelta-transmission disabled for local transfer or --whole-file\ncd++++++++++ ./\n\>f++++++++++ Dockerfile\n\>f++++++++++ addJdk.groovy\n\>f++++++++++ addMaven.groovy\n\>f++++++++++ addUsers.groovy\n\>f++++++++++ plugins.txt\ntotal: matches=0 hash\_hits=0 false\_alarms=0 data=1564\n\nsent 1,183 bytes received 227 bytes 2,820.00 bytes/sec\ntotal size is 1,564 speedup is 1.11\n”, “rc”: 0, “stdout\_lines”: [“building file list … done”, “created directory /tmp/docker-jenkins”, “delta-transmission disabled for local transfer or --whole-file”, “cd++++++++++ ./”, “\>f++++++++++ Dockerfile”, “\>f++++++++++ addJdk.groovy”, “\>f++++++++++ addMaven.groovy”, “\>f++++++++++ addUsers.groovy”, “\>f++++++++++ plugins.txt”, “total: matches=0 hash\_hits=0 false\_alarms=0 data=1564”, “sent 1,183 bytes received 227 bytes 2,820.00 bytes/sec”, "total size is 1,564 speedup is 1.11“]}

afterwards the folder /tmp/docker-jenkins exists locally but not in the vagrant box

I found some bug reports that seem to indicate that this particular problem is solved: [https://github.com/ansible/ansible/pull/14140](https://github.com/ansible/ansible/pull/14140)  
However it is not working for me.

Is anyone using this combination successfully and can show me a working configuration snippet?

best regards,  
Alphonse Bendt
