I have got an error in my project, when I am trying to copy from local directory to remote one
error message:
fatal: [xxx]: FAILED! => {
"changed": false, "msg": "could not find
src=/Users/xxx/Desktop/Docker/The_Task/./roles/docker_registry/templates,
Could not find or access
'/Users/xxx/Desktop/Docker/The_Task/./roles/docker_registry/templates'
on the Ansible Controller.\n
If you are using a module and expect the file to exist on the remote, see the remote_src option"
}
playbook.yml
- name: Copying required files
template:
src: ./roles/docker_registry/templates
dest: /tmp/docker_registry
if i do:
cd /Users/xxx/Desktop/Docker/The_Task/./roles/docker_registry/templates
it changes directory to the directory i want to … the error seems to be from ansible side. ( it doesnt work with absolute path eighter )
if I use the default copy module, then it works pretty much fine
- name: copy files [local -> remote]
copy:
src: ./roles/docker_registry/templates
dest: /tmp/docker_registry
any idea what should i do to make it work ? [ its copying from LOCAL -> REMOTE ]
Best Answer
Solution only for "Files"
okay, I am gonna keep this, just in case someone will stumble upon the same problem as I did ... the thing i messed up is that
src:
is looking into the rolestemplates
files ... the error has told me that its accessing thefull path
which is not true ... its accessing only atemplates
file and it continues from there ...fixed code: