|
|
@ -528,10 +528,17 @@ To escape special characters within a regex, use the "regex_escape" filter::
|
|
|
|
# convert '^f.*o(.*)$' to '\^f\.\*o\(\.\*\)\$'
|
|
|
|
# convert '^f.*o(.*)$' to '\^f\.\*o\(\.\*\)\$'
|
|
|
|
{{ '^f.*o(.*)$' | regex_escape() }}
|
|
|
|
{{ '^f.*o(.*)$' | regex_escape() }}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
To make use of one attribute from each item in a list of complex variables, use the "map" filter (see the `Jinja2 map() docs`_ for more)::
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# get a comma-separated list of the mount points (e.g. "/,/mnt/stuff") on a host
|
|
|
|
|
|
|
|
{{ ansible_mounts|map(attribute='mount')|join(',') }}
|
|
|
|
|
|
|
|
|
|
|
|
A few useful filters are typically added with each new Ansible release. The development documentation shows
|
|
|
|
A few useful filters are typically added with each new Ansible release. The development documentation shows
|
|
|
|
how to extend Ansible filters by writing your own as plugins, though in general, we encourage new ones
|
|
|
|
how to extend Ansible filters by writing your own as plugins, though in general, we encourage new ones
|
|
|
|
to be added to core so everyone can make use of them.
|
|
|
|
to be added to core so everyone can make use of them.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.. _Jinja2 map() docs: http://jinja.pocoo.org/docs/dev/templates/#map
|
|
|
|
|
|
|
|
|
|
|
|
.. _builtin filters: http://jinja.pocoo.org/docs/templates/#builtin-filters
|
|
|
|
.. _builtin filters: http://jinja.pocoo.org/docs/templates/#builtin-filters
|
|
|
|
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
.. seealso::
|
|
|
|