bitbucket not compatible with ansible

XMLWordPrintable

      I am trying to use ansible to download binaries so that I can install them. I have them in the Bitbucket downloads location.

      I use the following to attempt to download the file

      - name: temporary download folder
        tempfile:
          state: directory
          suffix: mybinaryfile
        register: mybinaryfile_download_directory
      
      - name: download mybinaryfile binary
        get_url:
          url: https://api.bitbucket.org/2.0/repositories/myteam/myproject/downloads/mybinaryfile-stable-linux-1.0.0-amd64.deb
          dest: '{{mybinaryfile_download_directory.path}}/mybinaryfile.deb'
          checksum: sha256:myfileschecksumdeadbeef0123456789abcdef0123456789abcdef012345678
          force_basic_auth: yes
          username: '{{bitbucket_email}}'
          password: '{{bitbucket_app_key}}'
      
      - name: install mybinaryfile deb
        apt:
          deb: '{{mybinaryfile_download_directory.path}}/mybinaryfile.deb'
      
      - name: remove temporary files for mybinaryfile
        file:
          path: '{{mybinaryfile_download_directory.path}}'
          state: absent
      

      When ansible sends this request, Bitbucket sends a 400 bad request in response.

      I can test ansible against w3 testing server jigsaw:

      - name: temporary download folder
        tempfile:
          state: directory
          suffix: jigsaw
        register: jigsaw_download_directory
      
      - name: download jigsaw binary
        get_url:
          url: 'https://jigsaw.w3.org/HTTP/Basic/'
          dest: '{{jigsaw_download_directory.path}}/jigsaw.deb'
      	checksum: sha256:myjigsawchecksumdeadbeef0123456789abcdef0123456789abcdef012345678
          force_basic_auth: yes
          username: 'guest'
          password: 'guest'
      

      Which works fine

      This is detailed failed response I am seeing:

      fatal: [localhost]: FAILED! => {
          "changed": false, 
          "dest": "/tmp/ansible.Of7Vpi*********/******.deb", 
          "elapsed": 1, 
          "invocation": {
              "module_args": {
                  "attributes": null, 
                  "backup": null, 
                  "checksum": "sha256:*********", 
                  "client_cert": null, 
                  "client_key": null, 
                  "content": null, 
                  "delimiter": null, 
                  "dest": "/tmp/ansible.Of7Vpi******/*****.deb", 
                  "directory_mode": null, 
                  "follow": false, 
                  "force": false, 
                  "force_basic_auth": true, 
                  "group": null, 
                  "headers": null, 
                  "http_agent": "ansible-httpget", 
                  "mode": null, 
                  "owner": null, 
                  "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
                  "regexp": null, 
                  "remote_src": null, 
                  "selevel": null, 
                  "serole": null, 
                  "setype": null, 
                  "seuser": null, 
                  "sha256sum": "", 
                  "src": null, 
                  "timeout": 10, 
                  "tmp_dest": null, 
                  "unsafe_writes": null, 
                  "url": "https://api.bitbucket.org/2.0/repositories/*****/****/downloads/******.deb", 
                  "url_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
                  "url_username": "********", 
                  "use_proxy": true, 
                  "username": "********", 
                  "validate_certs": true
              }
          }, 
          "msg": "Request failed", 
          "response": "HTTP Error 400: Bad Request", 
          "status_code": 400, 
          "url": "https://api.bitbucket.org/2.0/repositories/*******/*******/downloads/*******.deb"
      }
      

            Assignee:
            Unassigned
            Reporter:
            Michael Power
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: