From f3b956a7efc8c9596a15c16eb7fa038dd8ba9dbb Mon Sep 17 00:00:00 2001 From: Tinyblargon <76069640+Tinyblargon@users.noreply.github.com> Date: Tue, 8 Oct 2024 17:35:35 +0200 Subject: [PATCH] docs: `unique` add missing settings (#84076) add the `case_sensitive` setting --- lib/ansible/plugins/filter/unique.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/ansible/plugins/filter/unique.yml b/lib/ansible/plugins/filter/unique.yml index c627816b2e8..83a4f92bace 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.