sap.sap_operations.any (1.25.0) — filter

Return true if any element in the iterable is truthy.

| "added in version" 1.7.0-galaxy of sap.sap_operations"

Authors: Kirill Satarin (@kksat)

Install collection

Install with ansible-galaxy collection install sap.sap_operations:==1.25.0


Add to requirements.yml

  collections:
    - name: sap.sap_operations
      version: 1.25.0

Description

Return true if any element in the iterable is truthy.

If not iterable, return the truthyness of value provided.

Returns False if the iterable is empty (empty list, or empty string).

Behaves like the Python builtin any function (for Iterable)

If not Iterable provided, behaves like the Python builtin bool function (for value)

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Test 'any' filter, this assertion is True
  ansible.builtin.assert:
    that: "{{ [true, true] | sap.sap_operations.any }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Test 'any' filter, this assertion is True
  ansible.builtin.assert:
    that: "{{ ['true', 'false'] | sap.sap_operations.any }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Test 'any' filter, this assertion is True
  ansible.builtin.assert:
    that: "{{ [1, 1] | sap.sap_operations.any }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Test 'any' filter, this assertion is True
  ansible.builtin.assert:
    that: "{{ not ([1, 0] | sap.sap_operations.any) }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Test 'any' filter, this assertion is True
  ansible.builtin.assert:
    that: "{{ ['1', '0'] | sap.sap_operations.any }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Test 'any' filter, this assertion is True
  ansible.builtin.assert:
    that: "{{ 1 | sap.sap_operations.any }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Test 'any' filter, this assertion is True
  ansible.builtin.assert:
    that: "{{ not ( 0 | sap.sap_operations.any ) }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Test 'any' filter, this assertion is True
  ansible.builtin.assert:
    that: "{{ '' | sap.sap_operations.any }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Test 'any' filter, this assertion is True
  ansible.builtin.assert:
    that: "{{ ' ' | sap.sap_operations.any }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Test 'any' filter, this assertion is True
  ansible.builtin.assert:
    that: "{{ {1: 2} | sap.sap_operations.any }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Test 'any' filter, this assertion is True
  ansible.builtin.assert:
    that: "{{ not ( None | sap.sap_operations.any ) }}"

Inputs

    
value:
    description: Iterable to check, if not iterable, return the truthyness of value provided.
    required: true

Outputs

data:
  description: True if any element in the iterable is truthy or value provided is
    truthy.
  example: true
  type: boolean