Regarding get_url issue in ansible

  • name: Download dms ear file to local
    get_url:
    url: “https://artifactory.sicpa.com/artifactory/{{ artifactory_folder }}/com/sicpa/gssd/tt040_my/server/dms/tt040_my-dms-ear/{{ dms_release_version }}/tt040_my-dms-ear-{{ dms_release_version }}.ear”
    dest: /tmp
    url_username: “{{ v_artifactory_user }}”
    url_password: “{{ v_artifactory_passwd }}”
    force_basic_auth: yes
    delegate_to: localhost
    #run_once: true
    tags: deploy_dms

error:

TASK [Download dms ear file to local] ****************************************** e[0;31mfatal: [dmsdb.tt040int.dev.sicpa.io → localhost]: FAILED! => {“changed”: false, “dest”: “/tmp”, “elapsed”: 0, “gid”: 0, “group”: “root”, “mode”: “01777”, “msg”: “Request failed”, “owner”: “root”, “response”: “HTTP Error 409: Conflict”, “size”: 196, “state”: “directory”, “status_code”: 409, “uid”: 0, “url”: “https://artifactory.sicpa.com/artifactory/gssd-dev-snapshots-local/com/sicpa/gssd/tt040_my/server/dms/tt040_my-dms-ear/2.6.0/tt040_my-dms-ear-2.6.0.ear”}e[0m

I was under the impression that delegate_to comes prior the TASK’s details, like

that aside the error messages makes me think to investigate what HTTP Error 409 is and go further down that road

Yes I agree with you I have tried to narrow down the issue based on the https status error 409 but could n’t be able to figure out.
Let me try once . Thanks for all your help.

Hi ,

Can some one help me the issue?

I could n’t be able to figure it out .

The error you're getting is from the API at https://artifactory.sicpa.com, and has nothing to do with the ansible get_url module that is used to interact with it.

get_url is merely a conveyor belt that is used to send your (incorrect) data.

You should find out how that API is supposed to be used.

Thanks for your input, but not sure how to verify jfrog API?
Can you please help me, meanwhile I can try to figure it?

Note: r u suggesting me to check jfrog API or else?

I don’t know what ‘jfrog’ is and what that has to do with this. Either way you should consult the docs for the api you’re trying to use, which (from your playbook and errors) is at

https://artifactory.sicpa.com/.

That should give you the information you need, to avoid errors like you got.

Hi Ashok,

It does appear as though the task has done its work well, there is an article here https://jfrog.com/knowledge-base/how-to-resolve-the-replication-error-conflict-409/ that should be able to give you an indicator as to what has gone wrong. The actual api is documented here https://www.jfrog.com/confluence/display/JFROG/Artifactory+REST+API

Regards

Ok got it let me try.

I have written some code in ansible.
Can you please let me know, whether it is syntax wise correct or not?

ansible-playbook --extra-vars “artifactory_folder=gssd-dev-snapshots-local” playbooks/deploy.yml

That syntax is OK, but your problem isn't about the syntax.
It's about the content that you post to the API.

I will tell you one more time: your problem is NOT with ansible.
Ansible is irrelevant in this case.

Your problem is with the data you post to the API.

Find a solution for that, phone up the admins of your API, read the docs, or do something else.

Dick