mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-24 17:20:22 -07:00
ternary filter
This commit is contained in:
parent
984d551257
commit
88daac4971
2 changed files with 16 additions and 2 deletions
|
@ -304,13 +304,17 @@ Get a random number from 1 to 100 but in steps of 10::
|
|||
Other Useful Filters
|
||||
--------------------
|
||||
|
||||
To use one value on true and another on false::
|
||||
|
||||
{{ name == "John" | ternary('Mr','Ms') }}
|
||||
|
||||
To concatenate a list into a string::
|
||||
|
||||
|
||||
{{ list | join(" ") }}
|
||||
|
||||
To get the last name of a file path, like 'foo.txt' out of '/etc/asdf/foo.txt'::
|
||||
|
||||
{{ path | basename }}
|
||||
{{ path | basename }}
|
||||
|
||||
To get the directory from a path::
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue