|
|
|
@ -1195,24 +1195,8 @@ This can then be used to reference hashes in Pod specifications::
|
|
|
|
|
|
|
|
|
|
.. versionadded:: 2.8
|
|
|
|
|
|
|
|
|
|
Other Useful Filters
|
|
|
|
|
````````````````````
|
|
|
|
|
|
|
|
|
|
To add quotes for shell usage::
|
|
|
|
|
|
|
|
|
|
- shell: echo {{ string_value | quote }}
|
|
|
|
|
|
|
|
|
|
To use one value on true and another on false (new in version 1.9)::
|
|
|
|
|
|
|
|
|
|
{{ (name == "John") | ternary('Mr','Ms') }}
|
|
|
|
|
|
|
|
|
|
To use one value on true, one value on false and a third value on null (new in version 2.8)::
|
|
|
|
|
|
|
|
|
|
{{ enabled | ternary('no shutdown', 'shutdown', omit) }}
|
|
|
|
|
|
|
|
|
|
To concatenate a list into a string::
|
|
|
|
|
|
|
|
|
|
{{ list | join(" ") }}
|
|
|
|
|
File and Path manipulations
|
|
|
|
|
```````````````````````````
|
|
|
|
|
|
|
|
|
|
To get the last name of a file path, like 'foo.txt' out of '/etc/asdf/foo.txt'::
|
|
|
|
|
|
|
|
|
@ -1267,6 +1251,25 @@ To get the root and extension of a path or filename (new in version 2.0)::
|
|
|
|
|
# with path == 'nginx.conf' the return would be ('nginx', '.conf')
|
|
|
|
|
{{ path | splitext }}
|
|
|
|
|
|
|
|
|
|
Other Useful Filters
|
|
|
|
|
````````````````````
|
|
|
|
|
|
|
|
|
|
To add quotes for shell usage::
|
|
|
|
|
|
|
|
|
|
- shell: echo {{ string_value | quote }}
|
|
|
|
|
|
|
|
|
|
To use one value on true and another on false (new in version 1.9)::
|
|
|
|
|
|
|
|
|
|
{{ (name == "John") | ternary('Mr','Ms') }}
|
|
|
|
|
|
|
|
|
|
To use one value on true, one value on false and a third value on null (new in version 2.8)::
|
|
|
|
|
|
|
|
|
|
{{ enabled | ternary('no shutdown', 'shutdown', omit) }}
|
|
|
|
|
|
|
|
|
|
To concatenate a list into a string::
|
|
|
|
|
|
|
|
|
|
{{ list | join(" ") }}
|
|
|
|
|
|
|
|
|
|
To work with Base64 encoded strings::
|
|
|
|
|
|
|
|
|
|
{{ encoded | b64decode }}
|
|
|
|
|