Skip to content

Commit

Permalink
Add expandvars jinja2 filter (ansible#38805)
Browse files Browse the repository at this point in the history
* Add expandvars jinja2 filter

* Add docs

* Minor edit
  • Loading branch information
mkrizek authored Apr 18, 2018
1 parent 1cc2aeb commit 8173602
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/docsite/rst/user_guide/playbooks_filters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,14 @@ To expand a path containing a tilde (`~`) character (new in version 1.5)::

{{ path | expanduser }}

To expand a path containing environment variables::

{{ path | expandvars }}

.. note:: `expandvars` expands local variables; using it on remote paths can lead to errors.

.. versionadded:: 2.6

To get the real path of a link (new in version 1.8)::

{{ path | realpath }}
Expand Down
1 change: 1 addition & 0 deletions lib/ansible/plugins/filter/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ def filters(self):
'basename': partial(unicode_wrap, os.path.basename),
'dirname': partial(unicode_wrap, os.path.dirname),
'expanduser': partial(unicode_wrap, os.path.expanduser),
'expandvars': partial(unicode_wrap, os.path.expandvars),
'realpath': partial(unicode_wrap, os.path.realpath),
'relpath': partial(unicode_wrap, os.path.relpath),
'splitext': partial(unicode_wrap, os.path.splitext),
Expand Down

0 comments on commit 8173602

Please sign in to comment.