- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# flattened – return single list completely flattened

- Synopsis
- Parameters
- Notes
- Examples
- Return Values
- Status

## Synopsis

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

## Parameters

Parameter | Choices/Defaults | Configuration | Comments
--- | --- | --- | ---
_terms - / required |  |  | lists to flatten

## Notes

Note

- unlike ‘items’ which only flattens 1 level, this plugin will continue to flatten until it cannot find lists anymore.
- aka highlander plugin, there can only be one (list).

## Examples

    - name: "'unnest' all elements into single list"
      debug: msg="all in one list {{lookup('flattened', [1,2,3,[5,6]], [a,b,c], [[5,6,1,3], [34,a,b,c]])}}"

## Return Values

Common return values are documented here, the following are the fields unique to this lookup:

Key | Returned | Description
--- | --- | ---
_raw list |  | flattened list

## Status

- This lookup is not guaranteed to have a backwards compatible interface. [preview]
- This lookup is maintained by the Ansible Community. [community]

### Authors

- Serge van Ginderachter <serge@vanginderachter.be>

Hint

If you notice any issues in this documentation, you can edit this document to improve it.

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.