# uri module not honoring src path

**URL:** <https://forum.ansible.com/t/uri-module-not-honoring-src-path/35698>\
**Category:** Ansible Project\
**Created:** [September 1, 2021, 4:23pm UTC](https://forum.ansible.com/t/uri-module-not-honoring-src-path/35698 "2021-09-01T16:23:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeffrey\_Nelson](https://avatars.discourse-cdn.com/v4/letter/j/e495f1/32.png) [@Jeffrey\_Nelson](https://forum.ansible.com/u/Jeffrey_Nelson)\
**Post date:** [September 1, 2021, 4:23pm UTC](https://forum.ansible.com/t/uri-module-not-honoring-src-path/35698/1 "2021-09-01T16:23:52Z")

</div>

Hello all, I am trying to upload a file using the uri module as follows. It appears as if the src path is being modified before the file is uploaded. NOTE: I have changed host names and user names in this message.

**Example Task:**

- name: “URI: Upload file to Nexus”  
uri:  
validate\_certs: no  
url: “{{ NexusRepositoryUploadUrl }}/repository/LOB/LOB-Environments/{{ environmentName }}/0.0.1/{{ environmentName }}.custom.properties”  
method: “PUT”  
status\_code:
- 201
- 200  
src: “{{ playbook\_dir }}/files/{{ environmentName }}.custom.properties”  
force\_basic\_auth: yes  
url\_username: “{{ NexusRepositoryUploadUsername }}”  
url\_password: “{{ (( lookup(‘tss’, NexusRepositoryUploadUsername) | from\_json).get(‘items’) | items2dict(key\_name=‘slug’, value\_name=‘itemValue’))[‘password’] }}”  
delegate\_to: localhost  
run\_once: yes

**Debug Output:**

fatal: [[myhost.mydomain.com](http://myhost.mydomain.com) → localhost]: FAILED! =\> {  
“changed”: false,  
“connection”: “close”,  
“content”: “”,  
“elapsed”: 0,  
“invocation”: {  
“module\_args”: {  
“attributes”: null,  
“backup”: null,  
“body”: null,  
“body\_format”: “raw”,  
“client\_cert”: null,  
“client\_key”: null,  
“content”: null,  
“creates”: null,  
“delimiter”: null,  
“dest”: null,  
“directory\_mode”: null,  
“follow”: false,  
“follow\_redirects”: “safe”,  
“force”: false,  
“force\_basic\_auth”: true,  
“group”: null,  
“headers”: {  
“Content-Length”: 4643  
},  
“http\_agent”: “ansible-httpget”,  
“method”: “PUT”,  
“mode”: null,  
“owner”: null,  
“regexp”: null,  
“remote\_src”: null,  
“removes”: null,  
“return\_content”: false,  
“selevel”: null,  
“serole”: null,  
“setype”: null,  
“seuser”: null,  
“src”: “/home/mylogin/.ansible/tmp/ansible-tmp-1630512343.7974522-125506191122975/test.custom.properties”,  
“status\_code”: [  
201,  
200  
],  
“timeout”: 30,  
“unix\_socket”: null,  
“unsafe\_writes”: null,  
“url”: “[https://nexus.mydomain.com/repository/LOB/LOB-Environments/test/0.0.1/test.custom.properties](https://nexus.mydomain.com/repository/LOB/LOB-Environments/test/0.0.1/test.custom.properties)”,  
“url\_password”: “VALUE\_SPECIFIED\_IN\_NO\_LOG\_PARAMETER”,  
“url\_username”: “nexuslogin”,  
“use\_proxy”: true,  
“validate\_certs”: false  
}  
},  
“msg”: “Status code was 500 and not [201, 200]: HTTP Error 500: Server Error”,  
“redirected”: false,  
“server”: “Nexus/3.29.0-02 (PRO)”,  
“status”: 500,  
“strict\_transport\_security”: “max-age=7776000”,  
“url”: “[https://nexus.mydomain.com/repository/LOB/LOB-Environments/test/0.0.1/test.custom.properties](https://nexus.mydomain.com/repository/LOB/LOB-Environments/test/0.0.1/test.custom.properties)”,  
“x\_content\_type\_options”: “nosniff”,  
“x\_frame\_options”: “DENY”  
}

You will notice that the src parameter in the task has /files/ before the actual file name, but the src paramter displayed in the debug is missing the /files/ portion of the path.

**Task: =** src: “{{ playbook\_dir }}/files/{{ environmentName }}.custom.properties”  
**Debug =** “src”: “/home/mylogin/.ansible/tmp/ansible-tmp-1630512343.7974522-125506191122975/test.custom.properties”

Thanks in advance for the assistance.
