Hi dear,
How can create variables in hash, example:
Hi dear,
How can create variables in hash, example:
key: {{ my_key | hash('sha1') }} ...
Hashing filters
New in version 1.9.
To get the sha1 hash of a string:
{{ 'test1' | hash('sha1') }}
To get the md5 hash of a string:
{{ 'test1' | hash('md5') }}
Get a string checksum:
{{ 'test2' | checksum }}
Other hashes (platform dependent):
{{ 'test2' | hash('blowfish') }}
To get a sha512 password hash (random salt):
{{ 'passwordsaresecret' | password_hash('sha512') }}
To get a sha256 password hash with a specific salt:
{{ 'secretpassword' | password_hash('sha256', 'mysecretsalt') }}
An idempotent method to generate unique hashes per system is to use a
salt that is consistent between runs:
{{ 'secretpassword' | password_hash('sha512', 65534 |
random(seed=inventory_hostname) | string) }}
Hi, thanks
Resolved