Proper example for splitext filter in docs (#70494)
* Update playbooks_filters.rst with a clear example of how to extract its 2 tokens. Co-authored-by: Sloane Hertel <shertel@redhat.com>
This commit is contained in:
parent
20bb915092
commit
7a42d27462
1 changed files with 8 additions and 0 deletions
|
@ -1519,6 +1519,14 @@ To get the root and extension of a path or file name (new in version 2.0)::
|
|||
# with path == 'nginx.conf' the return would be ('nginx', '.conf')
|
||||
{{ path | splitext }}
|
||||
|
||||
The ``splitext`` filter returns a string. The individual components can be accessed by using the ``first`` and ``last`` filters::
|
||||
|
||||
# with path == 'nginx.conf' the return would be 'nginx'
|
||||
{{ path | splitext | first }}
|
||||
|
||||
# with path == 'nginx.conf' the return would be 'conf'
|
||||
{{ path | splitext | last }}
|
||||
|
||||
To join one or more path components::
|
||||
|
||||
{{ ('/etc', path, 'subdir', file) | path_join }}
|
||||
|
|
Loading…
Reference in a new issue