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) }}



On Fri, Jan 25, 2019 at 8:11 PM Rafael Tomelin <[email protected]> wrote:
>
> Hi dear,
>
> How can create variables in hash, example:
>
> ---
> # vars file for roles
> my_var_root:
>     my_sub_var:
>         name: example
>         env: environment
>         key: my_key
>
> And how, pull in code?
>
> --
> Atenciosamente,
>
> Rafael Tomelin
> Tel.: 51-84104084
> Skype: rafael.tomelin
>
> LPI ID: LPI000191271
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> 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.

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAOK917TQSnXHsV6SbW7uca%2BxOY7WxEDgDjQXSokifo5a1w%3DFMQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to