symmetric_difference¶
Collection Note
This module is part of the ansible.builtin collection. To install the collection, use:
Added in version1.4.
Synopsis¶
- Provide a unique list of all the elements unique to each list.
- Items in the resulting list are returned in arbitrary order.
Parameters¶
| Parameter | Defaults / Choices | Comments |
|---|---|---|
| _input list required |
A list. | |
| _second_list list required |
A list. |
Examples¶
# return the elements of list1 not in list2 and the elements in list2 not in list1
# list1: [1, 2, 5, 1, 3, 4, 10]
# list2: [1, 2, 3, 4, 5, 11, 99]
{{ list1 | symmetric_difference(list2) }}
# => [10, 11, 99]
Return Values¶
| Key | Data Type | Description | Returned |
|---|---|---|---|
| _value | list | A unique list of the elements from two lists that are unique to each one. |
Authors¶
- Brian Coca (@bcoca)