permutations¶
Collection Note
This module is part of the ansible.builtin collection. To install the collection, use:
Added in versionhistorical.
Synopsis¶
- Create a list of the permutations of lists from the elements of a list.
- Unlike combinations, in permutations order is significant.
Parameters¶
| Parameter | Defaults / Choices | Comments |
|---|---|---|
| _input list required |
Elements to base the permutations on. | |
| list_size int required |
The size of the list for each permutation. |
Examples¶
# ptrs_of_two => [ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 1, 5 ], [ 2, 1 ], [ 2, 3 ], [ 2, 4 ], [ 2, 5 ], [ 3, 1 ], [ 3, 2 ], [ 3, 4 ], [ 3, 5 ], [ 4, 1 ], [ 4, 2 ], [ 4, 3 ], [ 4, 5 ], [ 5, 1 ], [ 5, 2 ], [ 5, 3 ], [ 5, 4 ] ]
prts_of_two: "{{ [1,2,3,4,5] | permutations(2) }}"
Return Values¶
| Key | Data Type | Description | Returned |
|---|---|---|---|
| _value | list | List of permutations lists resulting from the supplied elements and list size. |