# 1.5 synchronize module does not copy from Ansible controller to inventory target

**URL:** <https://forum.ansible.com/t/1-5-synchronize-module-does-not-copy-from-ansible-controller-to-inventory-target/14728>\
**Category:** Ansible Project\
**Created:** [March 7, 2014, 4:27pm UTC](https://forum.ansible.com/t/1-5-synchronize-module-does-not-copy-from-ansible-controller-to-inventory-target/14728 "2014-03-07T16:27:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Shenton](https://avatars.discourse-cdn.com/v4/letter/c/f9ae1b/32.png) [@Chris\_Shenton](https://forum.ansible.com/u/Chris_Shenton)\
**Post date:** [March 7, 2014, 4:27pm UTC](https://forum.ansible.com/t/1-5-synchronize-module-does-not-copy-from-ansible-controller-to-inventory-target/14728/1 "2014-03-07T16:27:05Z")

</div>

I’m trying to copy a bunch of files, recurisvely, from my Ansible control machine to the inventory target. The ‘synchronize’ module (in 1.5) sounds like it does just what I need:

```auto
# Synchronization of src on the control machine to dest on the remote hosts
synchronize: src=some/relative/path dest=/some/absolute/path

```

```auto

```

```auto
When I use it, however, it tries to copy from the target machine to the target machine.

```

```auto
- synchronize: src=/Users/chris/Projects/smd/ dest=/tmp/

```

```auto
msg: rsync: change_dir "/Users/chris/Projects/smd" failed: No such file or directory (2)

```

```auto
/Users/chris/Projects/smd does exist on my controller, but not my target; it appears it's treating both src and dest on the target.

```

```auto
If I try and make this a local_action, it tries to copy from and *to* my ansible controller machine

```

```auto
- local_action: synchronize src=/Users/chris/.MacOSX dest=/tmp

```

```auto
Does copy my local machine's homedir config info to my local machine's /tmp/ dir

```

```auto
I've read a bunch of the threads on this but it's not clear how to invoke this common operation, abut more importantly, the doc example that state "src on control machine to dest on remote hosts" is not what this module is actually doing.

```

```auto
I've thrown some 'pdb' into the synchronize.py module and see that (without local_action) it does create an rsync command, copy a file with that command to the remote, then run it there, so it makes sense that it would be doing src and dest on the remote -- contrary to the doc example.

```

```auto

```

```auto
Any suggestions?

```

```auto
Thanks

```

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [March 7, 2014, 5:18pm UTC](https://forum.ansible.com/t/1-5-synchronize-module-does-not-copy-from-ansible-controller-to-inventory-target/14728/2 "2014-03-07T17:18:04Z")

</div>

Please show us the ansible-playbook -vvvv output for the task.

---

<div class="post-metadata">

**Author:** ![Chris\_Shenton](https://avatars.discourse-cdn.com/v4/letter/c/f9ae1b/32.png) [@Chris\_Shenton](https://forum.ansible.com/u/Chris_Shenton)\
**Post date:** [March 7, 2014, 6:20pm UTC](https://forum.ansible.com/t/1-5-synchronize-module-does-not-copy-from-ansible-controller-to-inventory-target/14728/3 "2014-03-07T18:20:31Z")

</div>

Here’s the play:

- name: Drupal | Add Libraries & Modules (synchronize)

synchronize: src=…/roles/drupal-install/files/{{ item }} dest={{ drupal\_path }}/sites/all/  
sudo: no  
with\_items:

- libraries
- modules  
tags: sync

And the run:

(drupal-ansible)bash-3.2$ ansible-playbook -t sync -i hosts/vagrant playbooks/drupal-boostrap.yml -vvvv

PLAY [webservers] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\<127.0.0.1\> ESTABLISH CONNECTION FOR USER: ubuntu  
\<127.0.0.1\> REMOTE\_MODULE setup  
\<127.0.0.1\> EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/Users/chris/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=2222’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘User=ubuntu’, ‘-o’, ‘ConnectTimeout=10’, ‘127.0.0.1’, “/bin/sh -c ‘mkdir -p /tmp/ansible-tmp-1394216215.84-11086530114397 && chmod a+rx /tmp/ansible-tmp-1394216215.84-11086530114397 && echo /tmp/ansible-tmp-1394216215.84-11086530114397’”]  
\<127.0.0.1\> PUT /var/folders/03/j6n21gy53ks5dk80cyh9c5800000gn/T/tmp4cvLiN TO /tmp/ansible-tmp-1394216215.84-11086530114397/setup  
\<127.0.0.1\> EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/Users/chris/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=2222’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘User=ubuntu’, ‘-o’, ‘ConnectTimeout=10’, ‘127.0.0.1’, ‘/bin/sh -c 'sudo -k && sudo -H -S -p “[sudo via ansible, key=zvkuutgiqcazqeyectujmpnblbhrfkni] password: " -u root /bin/sh -c '”'“'echo SUDO-SUCCESS-zvkuutgiqcazqeyectujmpnblbhrfkni; /usr/bin/python /tmp/ansible-tmp-1394216215.84-11086530114397/setup; rm -rf /tmp/ansible-tmp-1394216215.84-11086530114397/ \>/dev/null 2\>&1'”'"''’]  
ok: [127.0.0.1]

TASK: [drupal-install | Drupal | Add Libraries & Modules (synchronize)] \*\*\*\*\*\*\*  
\<127.0.0.1\> ESTABLISH CONNECTION FOR USER: ubuntu  
\<127.0.0.1\> EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/Users/chris/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=2222’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘User=ubuntu’, ‘-o’, ‘ConnectTimeout=10’, ‘127.0.0.1’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1394216217.23-26780158979732 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1394216217.23-26780158979732 && echo $HOME/.ansible/tmp/ansible-tmp-1394216217.23-26780158979732’”]  
\<127.0.0.1\> PUT /var/folders/03/j6n21gy53ks5dk80cyh9c5800000gn/T/tmp66LBCq TO /home/ubuntu/.ansible/tmp/ansible-tmp-1394216217.23-26780158979732/synchronize  
\<127.0.0.1\> EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/Users/chris/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=2222’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘User=ubuntu’, ‘-o’, ‘ConnectTimeout=10’, ‘127.0.0.1’, “/bin/sh -c ‘/usr/bin/python /home/ubuntu/.ansible/tmp/ansible-tmp-1394216217.23-26780158979732/synchronize; rm -rf /home/ubuntu/.ansible/tmp/ansible-tmp-1394216217.23-26780158979732/ \>/dev/null 2\>&1’”]  
failed: [127.0.0.1] =\> (item=libraries) =\> {“cmd”: “rsync --delay-updates -FF --compress --timeout=10 --archive --rsh ‘ssh -o StrictHostKeyChecking=no -o Port=2222’ --out-format=‘\<\>%i %n%L’ …/roles/drupal-install/files/libraries /home/ubuntu/www/drupal//sites/all/”, “failed”: true, “item”: “libraries”, “rc”: 23}  
msg: rsync: change\_dir “/home/ubuntu//…/roles/drupal-install/files” failed: No such file or directory (2)  
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1070) [sender=3.0.9]

\<127.0.0.1\> ESTABLISH CONNECTION FOR USER: ubuntu  
\<127.0.0.1\> EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/Users/chris/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=2222’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘User=ubuntu’, ‘-o’, ‘ConnectTimeout=10’, ‘127.0.0.1’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1394216217.47-32135159071547 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1394216217.47-32135159071547 && echo $HOME/.ansible/tmp/ansible-tmp-1394216217.47-32135159071547’”]  
\<127.0.0.1\> PUT /var/folders/03/j6n21gy53ks5dk80cyh9c5800000gn/T/tmpuAQh52 TO /home/ubuntu/.ansible/tmp/ansible-tmp-1394216217.47-32135159071547/synchronize  
\<127.0.0.1\> EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/Users/chris/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=2222’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘User=ubuntu’, ‘-o’, ‘ConnectTimeout=10’, ‘127.0.0.1’, “/bin/sh -c ‘/usr/bin/python /home/ubuntu/.ansible/tmp/ansible-tmp-1394216217.47-32135159071547/synchronize; rm -rf /home/ubuntu/.ansible/tmp/ansible-tmp-1394216217.47-32135159071547/ \>/dev/null 2\>&1’”]  
failed: [127.0.0.1] =\> (item=modules) =\> {“cmd”: “rsync --delay-updates -FF --compress --timeout=10 --archive --rsh ‘ssh -o StrictHostKeyChecking=no -o Port=2222’ --out-format=‘\<\>%i %n%L’ …/roles/drupal-install/files/modules /home/ubuntu/www/drupal//sites/all/”, “failed”: true, “item”: “modules”, “rc”: 23}  
msg: rsync: change\_dir “/home/ubuntu//…/roles/drupal-install/files” failed: No such file or directory (2)  
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1070) [sender=3.0.9]

FATAL: all hosts have already failed – aborting

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
to retry, use: --limit @/Users/chris/drupal-boostrap.retry

127.0.0.1 : ok=1 changed=0 unreachable=0 failed=1

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [March 7, 2014, 10:00pm UTC](https://forum.ansible.com/t/1-5-synchronize-module-does-not-copy-from-ansible-controller-to-inventory-target/14728/4 "2014-03-07T22:00:03Z")

</div>

Looks like you are using vagrant with the virtualbox provisioner. Can we see the inventory file just to confirm? Should exist next to your vagrant file if you were using vagrant provision.

---

<div class="post-metadata">

**Author:** ![Chris\_Shenton](https://avatars.discourse-cdn.com/v4/letter/c/f9ae1b/32.png) [@Chris\_Shenton](https://forum.ansible.com/u/Chris_Shenton)\
**Post date:** [March 7, 2014, 10:12pm UTC](https://forum.ansible.com/t/1-5-synchronize-module-does-not-copy-from-ansible-controller-to-inventory-target/14728/5 "2014-03-07T22:12:21Z")

</div>

I haven’t yet tried the Ansible provisioner in Vagrant (too ignorant), was just trying to get a VirtualBox up and running instead of using AWS instances I had been running against. So I hacked out the least Puppet i needed to get an account that Ansible could use. In my Vagrantfile:

config.vm.provision :puppet do |puppet|  
puppet.module\_path = “puppet/modules”  
puppet.manifests\_path = “puppet/manifests”  
puppet.manifest\_file = “create-ubuntu-user.pp”  
end

It gives me a box I can SSH to on localhost with port 2222.

Then in the Ansible inventory file, hosts/vagrant I have:

[webservers]  
127.0.0.1

[webservers:vars]  
ansible\_ssh\_port=2222

Oh… “localhost”… duh, hmmm. I wonder if it’s confused because the Ansible controller is localhost and so is the Vagrant box target, albeit with a different port?

Thanks.

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [March 7, 2014, 10:24pm UTC](https://forum.ansible.com/t/1-5-synchronize-module-does-not-copy-from-ansible-controller-to-inventory-target/14728/6 "2014-03-07T22:24:05Z")

</div>

Would you mind trying it this way? … [webservers] default ansible\_ssh\_host=127.0.0.1 [webservers:vars] ansible\_ssh\_port=2222 I suspect delegation to a host named ‘127.0.0.1’ might be problematic for the synchronize action plugin.

---

<div class="post-metadata">

**Author:** ![Chris\_Shenton](https://avatars.discourse-cdn.com/v4/letter/c/f9ae1b/32.png) [@Chris\_Shenton](https://forum.ansible.com/u/Chris_Shenton)\
**Post date:** [March 10, 2014, 4:06pm UTC](https://forum.ansible.com/t/1-5-synchronize-module-does-not-copy-from-ansible-controller-to-inventory-target/14728/7 "2014-03-10T16:06:39Z")

</div>

OK, that worked fine. I don’t understand why, however. ☹

Thanks for your help!
