Checksum error after downloading hadoop-3.2.2.tar.gz file using Ansible

Viewed 114

I downloaded hadoop-3.2.2.tar.gz with the following Ansible code and checked the file. Of course, this is the official Hadoop homepage.

---
- hosts: all
  remote_user: root
  tasks:
  - name: Download file with checksum url (sha256)
    get_url:
      url: https://downloads.apache.org/hadoop/common/hadoop-3.2.2/hadoop-3.2.2.tar.gz
      dest: ~/hadoop-3.2.2.tar.gz
      checksum: sha256:https://downloads.apache.org/hadoop/common/hadoop-3.2.2/hadoop-3.2.2.tar.gz.sha512

But the following error occurred:

TASK [Download file with checksum url (sha256)] **********************************************************************************************
[WARNING]: File '/home/pi/hadoop-3.2.2.tar.gz' created with default permissions '666'. The previous default was '666'. Specify 'mode' to
avoid this warning.
fatal: [raspberrypi.local]: FAILED! => {"changed": true, "checksum_dest": null, "checksum_src": "f4fa4e95192c6bb33258b8bd7adb0267a306ba27", "dest": "/home/pi/hadoop-3.2.2.tar.gz", "elapsed": 240, "msg": "The checksum for /home/pi/hadoop-3.2.2.tar.gz did not match 054753301927d31a69b80be3e754fd330312f0b1047bcfa4ab978cdce18319ed912983e6022744d8f0c8765b98c87256eb1c3017979db1341d583d2cee22d029; it was 97e73b46c3972cd3c40c2295bd9488843c24e8503c36e7c57f6e6ecc4e12b8c3.", "src": "/home/pi/.ansible/tmp/ansible-tmp-1626856834.62967-13587-200540362585671/tmp2xh8cfra", "url": "https://downloads.apache.org/hadoop/common/hadoop-3.2.2/hadoop-3.2.2.tar.gz"}

Does this mean, that hadoop-3.2.2.tar.gz has been compromized, or is there something wrong with the code?

1 Answers

You are downloading a sha512 checksum, but specify sha256. So ansible expects the wrong checksum, thus the verification fails.

This should work:

checksum: sha512:https://downloads.apache.org/hadoop/common/hadoop-3.2.2/hadoop-3.2.2.tar.gz.sha512
Related