mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 14:20:22 -07:00
adding min() and max() filters for use in Jinja templates
This commit is contained in:
parent
2d2178f2c5
commit
3ba516ac25
3 changed files with 32 additions and 0 deletions
|
@ -180,6 +180,20 @@ Jinja2 provides a useful 'default' filter, that is often a better approach to fa
|
|||
In the above example, if the variable 'some_variable' is not defined, the value used will be 5, rather than an error
|
||||
being raised.
|
||||
|
||||
.. _list_filters:
|
||||
|
||||
List Filters
|
||||
--------------------
|
||||
.. versionadded:: 1.7
|
||||
|
||||
To get the minimum value from list of numbers::
|
||||
|
||||
{{ list1 | min }}
|
||||
|
||||
To get the maximum value from a list of numbers::
|
||||
|
||||
{{ [3, 4, 2] | max }}
|
||||
|
||||
.. _set_theory_filters:
|
||||
|
||||
Set Theory Filters
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue