# include\_tasks: Unable to retrieve file contents\\nCould not find or access

**URL:** <https://forum.ansible.com/t/include-tasks-unable-to-retrieve-file-contents-ncould-not-find-or-access/28321>\
**Category:** Ansible Project\
**Created:** [August 13, 2018, 4:54pm UTC](https://forum.ansible.com/t/include-tasks-unable-to-retrieve-file-contents-ncould-not-find-or-access/28321 "2018-08-13T16:54:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![OM\_Nachiketa](https://avatars.discourse-cdn.com/v4/letter/o/3da27b/32.png) [@OM\_Nachiketa](https://forum.ansible.com/u/OM_Nachiketa)\
**Post date:** [August 13, 2018, 4:54pm UTC](https://forum.ansible.com/t/include-tasks-unable-to-retrieve-file-contents-ncould-not-find-or-access/28321/1 "2018-08-13T16:54:58Z")

</div>

I am trying to run some tasks with variable but running in this error "FAILED! =\> {“reason”: “Unable to retrieve file contents\nCould not find or access 'path to my .yml ’ on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote\_src option”}

the task is to check and verify a response.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lozada\_De\_L](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@Jonathan\_Lozada\_De\_L](https://forum.ansible.com/u/Jonathan_Lozada_De_L)\
**Post date:** [August 13, 2018, 4:56pm UTC](https://forum.ansible.com/t/include-tasks-unable-to-retrieve-file-contents-ncould-not-find-or-access/28321/2 "2018-08-13T16:56:09Z")

</div>

can you paste the tasks? hard to tell with just the errors.

---

<div class="post-metadata">

**Author:** ![OM\_Nachiketa](https://avatars.discourse-cdn.com/v4/letter/o/3da27b/32.png) [@OM\_Nachiketa](https://forum.ansible.com/u/OM_Nachiketa)\
**Post date:** [August 13, 2018, 5:10pm UTC](https://forum.ansible.com/t/include-tasks-unable-to-retrieve-file-contents-ncould-not-find-or-access/28321/3 "2018-08-13T17:10:29Z")

</div>

this line calls the task include\_tasks: includes/find\_ucp.yml ping\_servers= “{{ groups.ucp }}”

- name: check  
uri:  
url: “https://{{ item }}.{{ domain\_name }}/auth/login”  
headers:  
Content-Type: application/json  
method: POST  
status\_code: 200,500  
body\_format: json  
validate\_certs: no  
body: ‘{“username”:“{{ ucp\_username }}”,“password”:“{{ ucp\_password }}”}’  
delegate\_to: localhost  
register: checks  
failed\_when: false  
changed\_when: false  
when: checks.status !=200 and checks.status != 500  
with\_items: “{{ ping\_servers }}”  
no\_log: yes

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lozada\_De\_L](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@Jonathan\_Lozada\_De\_L](https://forum.ansible.com/u/Jonathan_Lozada_De_L)\
**Post date:** [August 13, 2018, 5:13pm UTC](https://forum.ansible.com/t/include-tasks-unable-to-retrieve-file-contents-ncould-not-find-or-access/28321/4 "2018-08-13T17:13:28Z")

</div>

how does your directory structure looks like? are you using a role? you can add find\_ucp.yml under tasks/ and when you do the include from main.yml or another .yml in the same directory it should grab it easier.

---

<div class="post-metadata">

**Author:** ![OM\_Nachiketa](https://avatars.discourse-cdn.com/v4/letter/o/3da27b/32.png) [@OM\_Nachiketa](https://forum.ansible.com/u/OM_Nachiketa)\
**Post date:** [August 13, 2018, 5:16pm UTC](https://forum.ansible.com/t/include-tasks-unable-to-retrieve-file-contents-ncould-not-find-or-access/28321/5 "2018-08-13T17:16:40Z")

</div>

[https://github.com/chris7444/Docker-Synergy](https://github.com/chris7444/Docker-Synergy) this is what I am trying to use.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lozada\_De\_L](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@Jonathan\_Lozada\_De\_L](https://forum.ansible.com/u/Jonathan_Lozada_De_L)\
**Post date:** [August 13, 2018, 5:22pm UTC](https://forum.ansible.com/t/include-tasks-unable-to-retrieve-file-contents-ncould-not-find-or-access/28321/6 "2018-08-13T17:22:38Z")

</div>

so there’s no way its going to find it because its a different total directory. I don’t know if the playbook file has like include\_vars or include\_tasks that points to the include/ dir but, its hard to tell with all all this directories and files. I suggest you do what I mentioned before.

copy the find\_ucp.yml to the role you are trying to use and put it on the tasks/ dir. Then from one of the .yml files in the tasks/ dir do the include\_tasks from there.
