Example of idempotent (pseudo-)random() usage. (#31048)
Add note to use idempotent random() seed based on inventory_hostname.
This commit is contained in:
parent
d07d9390d7
commit
90dd698b86
1 changed files with 3 additions and 0 deletions
|
@ -452,6 +452,9 @@ To get a sha256 password hash with a specific salt::
|
||||||
|
|
||||||
{{ 'secretpassword'|password_hash('sha256', 'mysecretsalt') }}
|
{{ '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) }}
|
||||||
|
|
||||||
Hash types available depend on the master system running ansible,
|
Hash types available depend on the master system running ansible,
|
||||||
'hash' depends on hashlib password_hash depends on passlib (http://passlib.readthedocs.io/en/stable/lib/passlib.hash.html).
|
'hash' depends on hashlib password_hash depends on passlib (http://passlib.readthedocs.io/en/stable/lib/passlib.hash.html).
|
||||||
|
|
Loading…
Reference in a new issue