Could not find or access a file that is in the local directory

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 ]


But still i can not copy the whole dir into the remote machine

1

1 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 roles templates files ... the error has told me that its accessing the full path which is not true ... its accessing only a templates file and it continues from there ...

fixed code:

- name: Copying required files template: src: docker-compose.yml dest: /tmp/docker_registry 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like