ansible.builtin.truthy test – Pythonic true
Note
This test plugin is part of ansible-core
and included in all Ansible installations. In most cases, you can use the short plugin name truthy
. However, we recommend you use the Fully Qualified Collection Name (FQCN) ansible.builtin.truthy
for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same test plugin name.
New in ansible-base 2.10
Synopsis
- This check is a more Python version of what is ‘true’.
- It is the opposite of ansible.builtin.falsy.
Input
This describes the input of the test, the value before is ansible.builtin.truthy
or is not ansible.builtin.truthy
.
Parameter | Comments |
---|---|
Input string / required | An expression that can be expressed in a boolean context. |
Keyword parameters
This describes keyword parameters of the test. These are the values key1=value1
, key2=value2
and so on in the following examples: input is ansible.builtin.truthy(key1=value1, key2=value2, ...)
and input is not ansible.builtin.truthy(key1=value1, key2=value2, ...)
Parameter | Comments |
---|---|
convert_bool boolean | Attempts to convert to strict python boolean vs normally acceptable values ( Choices:
|
Examples
thisistrue: '{{ "any string" is truthy }}' thisisfalse: '{{ "" is truthy }}'
Return Value
Key | Description |
---|---|
Return value boolean | Returns Returned: success |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2024 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/truthy_test.html