From e65be0beee305698099e0ef6a21559148962416b Mon Sep 17 00:00:00 2001 From: Baptiste Mille-Mathias Date: Tue, 19 Nov 2019 19:30:56 +0100 Subject: [PATCH] Put all files and Path filters under a specific section (#64913) Many of the filters in the "other useful filters" list manipulate filenames and paths; add a heading and put them together. --- .../rst/user_guide/playbooks_filters.rst | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/docs/docsite/rst/user_guide/playbooks_filters.rst b/docs/docsite/rst/user_guide/playbooks_filters.rst index 5c144eebb0c..9ae246c1e33 100644 --- a/docs/docsite/rst/user_guide/playbooks_filters.rst +++ b/docs/docsite/rst/user_guide/playbooks_filters.rst @@ -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 }}