Missing something with host directory/file paths

It’s been awhile since I played with Ansible and right now Im tearing my hair out on this copy problem. Im trying to copy a directory on a Linux host to a new location. In ad-hoc ansible, it looks like this…

ansible -m copy -a “src=/usr/share/folder1 dest=/config/folder2” servers

When I run this command, Ansible tells me it can’t find the directory…

10.10.10.107 | FAILED! => {
“changed”: false,
“failed”: true,
“msg”: “Unable to find ‘/usr/share/folder1’ in expected paths.”
}

Yet, when I go on the host, I can clearly see that the source directory exists. Im thinking this is something terribly obvious since I’ve now tried this on multiple hosts and get the same error each time. I know Ansible is working because I can run adhoc shell commands and touch files, see the pwd, etc.

Any ideas at all? What am I missing?

Thanks!

by default ansible looks in the local ‘controller’ for the src= parameter, you need to use remote_src=yes for it to look for it on the target machine.

Also note that remote_src=yes does not support recursive copying.

Thank you! Is there a better means to recursively copy then? Or do I need to copy each file separately?

I’ll answer this for myself. Seems like just using the command module and doing the copy that way is the best approach.

Thanks for putting me on the right track!