community.general.flattened (8.5.0) — lookup

return single list completely flattened

Authors: Serge van Ginderachter (!UNKNOWN) <serge@vanginderachter.be>

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Given one or more lists, this lookup will flatten any list elements found recursively until only 1 list is left.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "'unnest' all elements into single list"
  ansible.builtin.debug:
    msg: "all in one list {{lookup('community.general.flattened', [1,2,3,[5,6]], ['a','b','c'], [[5,6,1,3], [34,'a','b','c']])}}"

Inputs

    
_terms:
    description: lists to flatten
    elements: raw
    required: true
    type: list

Outputs

_raw:
  description:
  - flattened list
  type: list