Add advice how to prevent jinja2 warning (#60594)
* Add advice how to prevent jinja2 warning ##### SUMMARY This addition helps users to demonstrate how to prevent `[WARNING]: when statements should not include jinja2 templating delimiters`. ##### ISSUE TYPE - Docs Pull Request +label: docsite_pr * Update playbooks_tests.rst * Update playbooks_tests.rst Refer to the advised FAQ about when to use `{{ }}`.
This commit is contained in:
parent
eac7fa1860
commit
f17a55a181
1 changed files with 9 additions and 0 deletions
|
@ -127,7 +127,16 @@ This test also accepts a 3rd parameter, ``strict`` which defines if strict versi
|
|||
|
||||
{{ sample_version_var is version('1.0', operator='lt', strict=True) }}
|
||||
|
||||
When using ``version`` in a playbook or role, don't use ``{{ }}`` as described in the `FAQ <https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#when-should-i-use-also-how-to-interpolate-variables-or-dynamic-variable-names>`_::
|
||||
|
||||
vars:
|
||||
my_version: 1.2.3
|
||||
|
||||
tasks:
|
||||
- debug:
|
||||
msg: "my_version is higher than 1.0.0"
|
||||
when: my_version is version('1.0.0', '>')
|
||||
|
||||
.. _math_tests:
|
||||
|
||||
Set theory tests
|
||||
|
|
Loading…
Reference in a new issue