Skip to content

Commit 6af93ad

Browse files
agowafelixfontein
andauthored
union filter documented incorrectly (#2403)
* union documented incorrectly The invalid documentation of union was fixed in ansible/ansible#82199 but didn't populate into this section of the docs. * Apply suggestions from code review Co-authored-by: Felix Fontein <[email protected]> --------- Co-authored-by: Felix Fontein <[email protected]>
1 parent cc9853c commit 6af93ad

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/docsite/rst/playbook_guide/playbooks_filters.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ Preserve nulls in a list, by default flatten removes them. :
11671167
Selecting from sets or lists (set theory)
11681168
=========================================
11691169

1170-
You can select or combine items from sets or lists.
1170+
You can select or combine items from sets or lists. Note, multisets are currently not supported and all of the following filters imply uniqueness. That means that duplicate elements are removed from the result.
11711171

11721172
.. versionadded:: 1.4
11731173

@@ -1179,14 +1179,14 @@ To get a unique set from a list:
11791179
{{ list1 | unique }}
11801180
# => [1, 2, 5, 3, 4, 10]
11811181
1182-
To get a union of two lists:
1182+
To get a union (with duplicate elements removed) of two lists:
11831183

11841184
.. code-block:: jinja
11851185
11861186
# list1: [1, 2, 5, 1, 3, 4, 10]
11871187
# list2: [1, 2, 3, 4, 5, 11, 99]
11881188
{{ list1 | union(list2) }}
1189-
# => [1, 2, 5, 1, 3, 4, 10, 11, 99]
1189+
# => [1, 2, 3, 4, 5, 99, 10, 11]
11901190
11911191
To get the intersection of 2 lists (unique list of all items in both):
11921192

@@ -1195,7 +1195,7 @@ To get the intersection of 2 lists (unique list of all items in both):
11951195
# list1: [1, 2, 5, 3, 4, 10]
11961196
# list2: [1, 2, 3, 4, 5, 11, 99]
11971197
{{ list1 | intersect(list2) }}
1198-
# => [1, 2, 5, 3, 4]
1198+
# => [1, 2, 3, 4, 5]
11991199
12001200
To get the difference of 2 lists (items in 1 that don't exist in 2):
12011201

@@ -1213,7 +1213,7 @@ To get the symmetric difference of 2 lists (items exclusive to each list):
12131213
# list1: [1, 2, 5, 1, 3, 4, 10]
12141214
# list2: [1, 2, 3, 4, 5, 11, 99]
12151215
{{ list1 | symmetric_difference(list2) }}
1216-
# => [10, 11, 99]
1216+
# => [99, 10, 11]
12171217
12181218
.. _math_stuff:
12191219

0 commit comments

Comments
 (0)