ansible.builtin.ternary (v2.16.0) — filter

Ternary operation filter

| "added in version" 1.9 of ansible.builtin"

Authors: Brian Coca (@bcoca)

Install Ansible via pip

Install with pip install ansible-core==2.16.0

Description

Return the first value if the input is V(True), the second if V(False).

Inputs

    
_input:
    description: A boolean expression, must evaluate to V(True) or V(False).
    required: true
    type: bool

none_val:
    description: Value to return if the input is V(None). If not set, V(None) will be
      treated as V(False).
    type: any
    version_added: '2.8'
    version_added_collection: ansible.builtin

true_val:
    description: Value to return if the input is V(True).
    required: true
    type: any

false_val:
    description: Value to return if the input is V(False).
    type: any

Outputs

_value:
  description: The value indicated by the input.
  type: any