shuffle¶
Collection Note
This module is part of the ansible.builtin collection. To install the collection, use:
Added in version2.6.
Synopsis¶
- Take the elements of the input list and return in a random order.
Parameters¶
| Parameter | Defaults / Choices | Comments |
|---|---|---|
| _input list / elements=any required |
A number or list to randomize. | |
| seed str |
If specified use a pseudo random selection instead (repeatable). |
Examples¶
randomized_list: "{{ ['a','b','c'] | shuffle}}"
per_host_repeatable: "{{ ['a','b','c'] | shuffle(seed=inventory_hostname) }}"
Return Values¶
| Key | Data Type | Description | Returned |
|---|---|---|---|
| _value | list | Random number or list element. |