mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
21 lines
398 B
YAML
21 lines
398 B
YAML
|
---
|
||
|
- name: Merge two lists by common attribute 'name'
|
||
|
set_fact:
|
||
|
list3: "{{ list1|
|
||
|
community.general.lists_mergeby(list2, 'name') }}"
|
||
|
vars:
|
||
|
list1:
|
||
|
- name: foo
|
||
|
extra: true
|
||
|
- name: bar
|
||
|
extra: false
|
||
|
- name: meh
|
||
|
extra: true
|
||
|
list2:
|
||
|
- name: foo
|
||
|
path: /foo
|
||
|
- name: baz
|
||
|
path: /baz
|
||
|
- debug:
|
||
|
var: list3
|