Search code examples
ansiblechecksumgeturl

Why Ansible get_url gives error about checksums?


I have a task in my ansible playbook, that downloads a java archive from a github url. The task is here:

- name: Download Jar Plugin
  get_url:
    url: https://GitHub-URL/plugins-1.0.5.jar
    dest: /app/plugins/

There's no mention of checksum, yet it gives this error:

fatal: [host]: FAILED! => {"changed": false, "msg": "attempted to take checksum of directory: /app/plugins/plugins-1.0.5.jar"}

anyone has any idea about this? Is there any workaround to make it download this java archive?


Solution

  • First of all GitHub is not the right location to keep binaries. Github does not allow us to store a single file greater than 100 MB in most cases. You you should have binaries kept in either a physical server or any cloud storage and pull it from there.

    Now, if you are really inclined to follow this bad practise I suggest you to create an equivalent unix curl first to do that. If you have an existing curl command to do that share that with us or simply use ansible shell module as a starting point. You can also try increasing timeouts as default is 10 secs only. Here's a snippet where timeout is set to 200 seconds.

    - name: Download Jar Plugin
      get_url:
        url: https://GitHub-URL/plugins-1.0.5.jar
        dest: /app/plugins/
        timeout: 200