uri module not honoring src path

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 → 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”,
“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”,
“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.