| Server IP : 172.67.134.116 / Your IP : 216.73.217.22 Web Server : Apache System : Linux server.rehabsharif.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64 User : nobi37te ( 1003) PHP Version : 8.2.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3.9/site-packages/ansible/plugins/filter/ |
Upload File : |
DOCUMENTATION:
name: flatten
version_added: "2.5"
short_description: flatten lists within a list
description:
- For a given list, take any elements that are lists and insert their elements into the parent list directly.
positional: _input, levels, skip_nulls
options:
_input:
description: First dictionary to combine.
type: dict
required: true
levels:
description: Number of recursive list depths to flatten.
type: int
skip_nulls:
description: Skip C(null)/C(None) elements when inserting into the top list.
type: bool
default: true
EXAMPLES: |
# [1,2,3,4,5,6]
flat: "{{ [1 , 2, [3, [4, 5]], 6] | flatten }}"
# [1,2,3,[4,5],6]
flatone: "{{ [1, 2, [3, [4, 5]], 6] | flatten(1) }}"
RETURN:
_value:
description: The flattened list.
type: list