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) }}
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
ansible-proje...@googlegroups.com.
> To post to this group, send email to
ansible...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAGEUqbApSGKH40R%3Dt3GLv9mccOK9ezEDsSk-DmTgX-apgP1y_g%40mail.gmail.com.
> For more options, visit
https://groups.google.com/d/optout.