@ -160,26 +160,26 @@ To get a random item from a list::
"{{ ['a','b','c']|random }}"
# => 'c'
To get a random number from 0 to supplied end::
To get a random number between 0 and a specified number::
"{{ 59 |random}} * ** * root /script/from/cron"
"{{ 60 |random}} * ** * root /script/from/cron"
# => '21 * ** * root /script/from/cron'
Get a random number from 0 to 100 but in steps of 10::
{{ 100 |random(step=10) }}
{{ 101 |random(step=10) }}
# => 70
Get a random number from 1 to 100 but in steps of 10::
{{ 100 |random(1, 10) }}
{{ 101 |random(1, 10) }}
# => 31
{{ 100 |random(start=1, step=10) }}
{{ 101 |random(start=1, step=10) }}
# => 51
As of Ansible version 2.3, it's also possible to initialize the random number generator from a seed. This way, you can create random-but-idempotent numbers::