Note
This filter plugin is part of ansible-core and included in all Ansible installations. In most cases, you can use the short plugin name permutations. However, we recommend you use the Fully Qualified Collection Name (FQCN) ansible.builtin.permutations for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same filter plugin name.
This describes the input of the filter, the value before | ansible.builtin.permutations.
Parameter | Comments |
|---|---|
Input list / elements=string / required | Elements to base the permutations on. |
This describes positional parameters of the filter. These are the values positional1, positional2 and so on in the following example: input | ansible.builtin.permutations(positional1, positional2, ...)
Parameter | Comments |
|---|---|
list_size integer / required | The size of the list for each permutation. |
# 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) }}"
Key | Description |
|---|---|
Return value list / elements=string | List of permutations lists resulting from the supplied elements and list size. Returned: success |
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/permutations_filter.html