community.general.flattened 查找 – 返回完全扁平化的单个列表
注意
此查找插件是 community.general 集合(版本 10.1.0)的一部分。
如果您正在使用 ansible
包,您可能已经安装了此集合。 它不包含在 ansible-core
中。 要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.general
。
要在 playbook 中使用它,请指定:community.general.flattened
。
概要
给定一个或多个列表,此查找将递归地扁平化找到的任何列表元素,直到只剩下一个列表。
术语
参数 |
注释 |
---|---|
要扁平化的列表 |
注释
注意
与仅扁平化 1 级的 ansible.builtin.items 查找不同,此插件将继续扁平化,直到找不到列表为止。
又名高地人插件,只能有一个(列表)。
示例
- 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']])}}"
返回值
键 |
描述 |
---|---|
扁平化列表 返回: 成功 |