summaryrefslogtreecommitdiffstats
path: root/lib/ansible/plugins/filter/shuffle.yml
blob: a7c3e7ed22b542a735544a193917d29bbd5338ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
DOCUMENTATION:
  name: shuffle
  version_added: "2.6"
  short_description: randomize a list
  description:
    - Take the elements of the input list and return in a random order.
  positional: _input
  options:
    _input:
      description: A number or list to randomize.
      type: list
      elements: any
      required: true
    seed:
      description: If specified use a pseudo random selection instead (repeatable).
      type: str

EXAMPLES: |

  randomized_list: "{{ ['a','b','c'] | shuffle}}"
  per_host_repeatable: "{{ ['a','b','c'] | shuffle(seed=inventory_hostname) }}"

RETURN:
  _value:
    description: Random number or list element.
    type: list
    elements: any