Random items or numbers
Theansible.builtin.randomfilter in Ansible is an extension of the default Jinja2 random filter, and can be used to return a random item from a sequence of items or to generate a random number based on a range.
To get a random item from a list:
To get a random number between 0 (inclusive) and a specified integer (exclusive):
To get a random number from 0 to 100 but in steps of 10:
To get a random number from 1 to 100 but in steps of 10:
You can initialize the random number generator from a seed to create random-but-idempotent numbers: