ansible get_url checksum

Additionally, if a checksum is passed to this parameter, and the file exist under the dest location, the destination_checksum would be calculated, and if checksum equals destination_checksum, the file download would be skipped (unless force is true). If the checksum does not equal destination_checksum, the destination file is deleted.

https://docs.ansible.com/ansible/latest/collections/ansible/builtin/get_url_module.html#parameter-checksum

checksum あり
- get_url:
    url: https://www.php.net/distributions/php-7.1.33.tar.gz
    dest: /usr/local/src/php-7.1.33.tar.gz
    checksum: sha256:0055f368ffefe51d5a4483755bd17475e88e74302c08b727952831c5b2682ea2

ファイルが dest の場所に存在する場合、destination_checksum を計算、checksum が destination_checksum と一致する場合、ファイルのダウンロードはスキップされる

ok: [foo.example.com] => {"changed": false, "checksum_dest": null, "checksum_src": null, "dest": "/usr/local/src/php-7.1.33.tar.gz", "elapsed": 0, "gid": 0, "group": "wheel", "mode": "0644", "msg": "file already exists", "owner": "root", "size": 19716547, "state": "file", "uid": 0, "url": "https://www.php.net/distributions/php-7.1.33.tar.gz"}

PHP 7.1.33 (tar.gz)
sha256: 0055f368ffefe51d5a4483755bd17475e88e74302c08b727952831c5b2682ea2

https://www.php.net/releases/

checksum なし
- get_url:
    url: https://www.php.net/distributions/php-7.1.33.tar.gz
    dest: /usr/local/src/php-7.1.33.tar.gz

ファイルが dest の場所に存在する場合も(常に)ファイルをダウンロード。チェックサムを比較する

ok: [foo.example.com] => {"changed": false, "checksum_dest": "bf7105ef1fb477a1ffa0ac8efadd4f74e603f4bc", "checksum_src": "bf7105ef1fb477a1ffa0ac8efadd4f74e603f4bc", "dest": "/usr/local/src/php-7.1.33.tar.gz", "elapsed": 78, "gid": 0, "group": "wheel", "mode": "0644", "msg": "OK (19716547 bytes)", "owner": "root", "size": 19716547, "src": "/home/asample/.ansible/tmp/ansible-tmp-1692262877.6185582-24038-156200185493667/tmpkodd3lqt", "state": "file", "uid": 0, "url": "https://www.php.net/distributions/php-7.1.33.tar.gz"}

ansible 2.8.6 get_url repeatedly downloads file with force==no · Issue #64016 · ansible/ansible · GitHub