recursive copy in v1.3

152 views
Skip to first unread message

Jason Harris

unread,
Sep 14, 2013, 7:42:26 PM9/14/13
to ansible...@googlegroups.com
I seem to recall seeing somewhere that v1.3 allowed some sort of recursive copying without resorting to a local command of rsync. But I can't seem to find this again after looking again... Am I missing something or do we still need to use this workaround?

Thanks,
   Jason

Michael DeHaan

unread,
Sep 15, 2013, 11:36:12 AM9/15/13
to ansible...@googlegroups.com
Hi Jason,

local_action: rsync is still the way to go.

It's almost always going to be a better/faster option.

What we were talking about was the 'synchronize' module, a wrapper around rsync to make the playbooks read a bit cleaner, that was very nice but we didn't quite get a quirk or two worked out in time to include it.

--Michael




--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Michael DeHaan <mic...@ansibleworks.com>
CTO, AnsibleWorks, Inc.
http://www.ansibleworks.com/

Timothy Appnel

unread,
Sep 16, 2013, 11:33:25 AM9/16/13
to ansible...@googlegroups.com, ansible...@googlegroups.com
This weekend I was working on integrating fixes to those quirks from smoothify. I'm not finished to submit a pull request but if you want to give it a try and test it out the branch is here:


<tim/>

Sent from my iPhone

Jason Harris

unread,
Sep 16, 2013, 3:38:52 PM9/16/13
to ansible...@googlegroups.com, Timothy Appnel
Thanks!! I will give it a try shortly!

Cheers,
   Jas
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Brian Coca

unread,
Dec 11, 2013, 2:08:35 PM12/11/13
to ansible...@googlegroups.com
Before the copy module supported it, you could do recursive copy, but it required multiple tasks.You could also use ansible pull and have an 'agent', which simplifies it enormously.

I know many tools offer recursive copy, but doing it right with permissions, sudo/su and multiple hosts is much harder than most realize. The current copy and syncronize modules go a long way, but don't handle every possible case (and probably will never do), I haven't found any tool that does so.

BrianAI

unread,
Dec 13, 2013, 3:35:50 PM12/13/13
to ansible...@googlegroups.com
Is this still with some issues?

I wanted to keep the src directory the "system of record" if you will...so that if I add / delete files from the ansible server i'm executing the playbook on, it will happen on the destination machine.
I know I could use command: rsync or shell: rsync or whatever, but according to the ansible module page, it seems like synchronize should at least handle this:


  3 - name: copy install pagages to server
  4   synchronize: src=etc/server1/scripts/ dest=/etc/server1/scripts/

I'm using this with roles, and from the error, it seems like it does not follow the same logic other things do with roles:

msg: rsync: change_dir "/home/brian/Documents/scripts/ansible//etc/server1/scripts" failed: No such file or directory (2)

seems like it doesn't go into the "files" folder of the role it's executing from, even though the ansible module speaks to relative paths.

Thoughts?

(From the ansible module website)

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

BrianAI

unread,
Dec 13, 2013, 11:11:14 PM12/13/13
to ansible...@googlegroups.com
I've got it working by specifying the relative path to where i am running the playbook from, but synchronize seems to not follow the concept of "roles" (or it doesn't reference file from the role directory that you're in.

Any thoughts to that?

Michael DeHaan

unread,
Dec 14, 2013, 12:01:29 PM12/14/13
to ansible...@googlegroups.com
it's possible that it doesn't, since it's new.

If you can share a minimal playbook to reproduce the problem of synchronize not knowing about the 'files/' subdirectory of a role, please file a ticket on GitHub and be sure to include the version of Ansible (should be x>=1.4) that you've tested this on.

Thanks!


On Fri, Dec 13, 2013 at 11:11 PM, BrianAI <brian.a....@gmail.com> wrote:
I've got it working by specifying the relative path to where i am running the playbook from, but synchronize seems to not follow the concept of "roles" (or it doesn't reference file from the role directory that you're in.

Any thoughts to that?

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

BrianAI

unread,
Dec 16, 2013, 10:20:30 AM12/16/13
to ansible...@googlegroups.com

i iordanov

unread,
Feb 22, 2014, 5:55:01 PM2/22/14
to ansible...@googlegroups.com
Hey guys,

I just wanted to confirm that Ansible 1.4.4 still has this issue (synchronize not treating paths specified for src as relative to the role as I would expect).

Also, since this does keep coming up, I use the synchronize module in order to ensure files I delete on the local side also get removed on the remote side.

Cheers and thanks!
iordan

Michael DeHaan

unread,
Feb 24, 2014, 2:34:06 PM2/24/14
to ansible...@googlegroups.com
Thanks, we're aware of synchronize not knowing about role paths entirely.    There's an open ticket on this.   Something we need to sort out.




--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages