summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTinyblargon <76069640+Tinyblargon@users.noreply.github.com>2024-10-08 17:35:35 +0200
committerGitHub <noreply@github.com>2024-10-08 17:35:35 +0200
commitf3b956a7efc8c9596a15c16eb7fa038dd8ba9dbb (patch)
treeedc67c9e788854c91f5e413972881a17002a1055
parentPlayIterator: skip tasks from already ran roles (#83793) (diff)
downloadansible-f3b956a7efc8c9596a15c16eb7fa038dd8ba9dbb.tar.xz
ansible-f3b956a7efc8c9596a15c16eb7fa038dd8ba9dbb.zip
docs: `unique` add missing settings (#84076)
add the `case_sensitive` setting
-rw-r--r--lib/ansible/plugins/filter/unique.yml12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/ansible/plugins/filter/unique.yml b/lib/ansible/plugins/filter/unique.yml
index c627816b2e..83a4f92bac 100644
--- a/lib/ansible/plugins/filter/unique.yml
+++ b/lib/ansible/plugins/filter/unique.yml
@@ -10,6 +10,10 @@ DOCUMENTATION:
description: A list.
type: list
required: true
+ case_sensitive:
+ description: Whether to consider case when comparing elements.
+ default: false
+ type: bool
seealso:
- plugin_type: filter
plugin: ansible.builtin.difference
@@ -24,6 +28,14 @@ EXAMPLES: |
# list1: [1, 2, 5, 1, 3, 4, 10]
{{ list1 | unique }}
# => [1, 2, 5, 3, 4, 10]
+
+ # return case sensitive unique elements
+ {{ ['a', 'A', 'a'] | unique('case_sensitive=true') }}
+ # => ['a', 'A']
+
+ # return case insensitive unique elements
+ {{ ['b', 'B', 'b'] | unique() }}
+ # => ['b']
RETURN:
_value:
description: A list with unique elements, also known as a set.