Skip to content

hash

Collection Note

This module is part of the ansible.builtin collection. To install the collection, use:

ansible-galaxy collection install ansible.builtin
Added in version 1.9.

Synopsis

  • Returns a configurable hash of the input data. Uses L(SHA-1, https://en.wikipedia.org/wiki/SHA-1) by default.

Parameters

Parameter Defaults / Choices Comments
_input
raw
required
Data to checksum.
hashtype
string
Default: sha1
Type of algorithm to produce the hash.
The list of available choices depends on the installed Python's hashlib.

Examples

# sha1_hash => "109f4b3c50d7b0df729d299bc6f8e9ef9066971f"
sha1_hash: {{ 'test2' | hash('sha1') }}
# md5 => "5a105e8b9d40e1329780d62ea2265d8a"
md5: {{ 'test2' | hash('md5') }}

Return Values

Key Data Type Description Returned
_value string The checksum of the input, as configured in O(hashtype).