summaryrefslogtreecommitdiffstats
path: root/lib/ansible/plugins/filter/combinations.yml
blob: a46e51e84d4334d0169c4d8fa9e6789ff8ca2dea (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
DOCUMENTATION:
  name: combinations
  version_added: "historical"
  short_description: combinations from the elements of a list
  description:
    - Create a list of combinations of sets from the elements of a list.
  positional: _input, set_size
  options:
    _input:
      description: Elements to combine.
      type: list
      required: true
    set_size:
      description: The size of the set for each combination.
      type: int
      required: true
EXAMPLES: |

  # combos_of_two => [ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 1, 5 ], [ 2, 3 ], [ 2, 4 ], [ 2, 5 ], [ 3, 4 ], [ 3, 5 ], [ 4, 5 ] ]
  combos_of_two: "{{ [1,2,3,4,5] | combinations(2) }}"


RETURN:
  _value:
    description: List of combination sets resulting from the supplied elements and set size.
    type: list