Skip to content

bool

Collection Note

This module is part of the ansible.builtin collection. To install the collection, use:

ansible-galaxy collection install ansible.builtin
Added in version historical.

Synopsis

  • Attempt to cast the input into a boolean (V(True) or V(False)) value.

Parameters

Parameter Defaults / Choices Comments
_input
raw
required
Data to cast.

Examples

# in vars
vars:
  isbool: "{{ (a == b) | bool }} "
  otherbool: "{{ anothervar | bool }} "

# in a task
...
when: some_string_value | bool

Return Values

Key Data Type Description Returned
_value bool The boolean resulting of casting the input expression into a V(True) or V(False) value.