# Import\_tasks unable to find relative file path

**URL:** <https://forum.ansible.com/t/import-tasks-unable-to-find-relative-file-path/44164>\
**Category:** Get Help\
**Tags:** templating\
**Created:** [July 29, 2025, 5:44pm UTC](https://forum.ansible.com/t/import-tasks-unable-to-find-relative-file-path/44164 "2025-07-29T17:44:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![trisha-dell](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/trisha-dell/32/8640_2.png) [@trisha-dell](https://forum.ansible.com/u/trisha-dell)\
**Post date:** [July 29, 2025, 5:44pm UTC](https://forum.ansible.com/t/import-tasks-unable-to-find-relative-file-path/44164/1 "2025-07-29T17:44:35Z")

</div>

I am unable to execute the import\_tasks with relative path.  
Following is the task:

```
- name: Fetching power state of iDRAC
  ansible.builtin.import_tasks: _fetch_uri.yml
  vars:
    uri: "/redfish/v1/Chassis/System.Embedded.1?$select=PowerState"
  until: idrac_output.json.PowerState == "Off"
  retries: 10
  delay: 30

```

This task returns the following error:

[ERROR]: Could not find or access ‘/home/Trisha/JIRA/new/ansible\_collections/dellemc/openmanage/tests/output/.tmp/integration/idrac\_redfish\_powerstate-txpwuy60-ÅÑŚÌβŁÈ/tests/integration/idrac\_redfish\_powerstate/tests/\_fetch\_uri.yml’ on the Ansible Controller: Unable to retrieve file contents.  
Could not find or access ‘/home/Trisha/JIRA/new/ansible\_collections/dellemc/openmanage/tests/output/.tmp/integration/idrac\_redfish\_powerstate-txpwuy60-ÅÑŚÌβŁÈ/tests/integration/idrac\_redfish\_powerstate/tests/\_fetch\_uri.yml’ on the Ansible Controller.  
If you are using a module and expect the file to exist on the remote, see the remote\_src option: [Errno 2] No such file or directory: ‘/home/Trisha/JIRA/new/ansible\_collections/dellemc/openmanage/tests/output/.tmp/integration/idrac\_redfish\_powerstate-txpwuy60-ÅÑŚÌβŁÈ/tests/integration/idrac\_redfish\_powerstate/tests/\_fetch\_uri.yml’

This task works fine in Ansible 2.18.

FYR:

> <https://github.com/dell/dellemc-openmanage-ansible-modules/blob/collections/tests/integration/targets/idrac_redfish_powerstate/tests/oem_reset_type_valid-11863.yaml>

---

<div class="post-metadata">

**Author:** ![shertel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/shertel/32/1241_2.png) [@shertel](https://forum.ansible.com/u/shertel)\
**Post date:** [July 30, 2025, 6:28pm UTC](https://forum.ansible.com/t/import-tasks-unable-to-find-relative-file-path/44164/2 "2025-07-30T18:28:13Z")

</div>

I was able to reproduce the issue. In 2.18, this was working because the value here is templated: [ansible/lib/ansible/playbook/helpers.py at stable-2.18 · ansible/ansible · GitHub](https://github.com/ansible/ansible/blob/stable-2.18/lib/ansible/playbook/helpers.py#L172). In 2.19, that value is no longer templated: [ansible/lib/ansible/playbook/helpers.py at stable-2.19 · ansible/ansible · GitHub](https://github.com/ansible/ansible/blob/stable-2.19/lib/ansible/playbook/helpers.py#L172). I think the change is a bug.

I’ve opened a pull request to get additional opinions: [Fix nested import\_tasks when the parent import contains a template by s-hertel · Pull Request #85599 · ansible/ansible · GitHub](https://github.com/ansible/ansible/pull/85599). If you’re able to verify it fixes the issue for you, I’d appreciate any feedback.

---

<div class="post-metadata">

**Author:** ![ildjarn](https://avatars.discourse-cdn.com/v4/letter/i/8491ac/32.png) [@ildjarn](https://forum.ansible.com/u/ildjarn)\
**Post date:** [July 31, 2025, 7:56am UTC](https://forum.ansible.com/t/import-tasks-unable-to-find-relative-file-path/44164/3 "2025-07-31T07:56:37Z")

</div>

Does

```auto
  ansible.builtin.import_tasks: ./_fetch_uri.yml

```

work?

---

<div class="post-metadata">

**Author:** ![mkrizek](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/mkrizek/32/2055_2.png) [@mkrizek](https://forum.ansible.com/u/mkrizek)\
**Post date:** [July 31, 2025, 10:57am UTC](https://forum.ansible.com/t/import-tasks-unable-to-find-relative-file-path/44164/4 "2025-07-31T10:57:49Z")

</div>

> Following is the task:
> 
> ```auto
> - name: Fetching power state of iDRAC
> ansible.builtin.import_tasks: _fetch_uri.yml
> vars:
> uri: "/redfish/v1/Chassis/System.Embedded.1?$select=PowerState"
> until: idrac_output.json.PowerState == "Off"
> retries: 10
> delay: 30
> 
> ```

Unrelated to your question but just FYI using `until` on `import_tasks` is not supported and is simply ignored.

> **[ansible.builtin.import\_tasks module – Import a task list — Ansible Community...](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/import_tasks_module.html#attribute-until)**
