2022-01-28 08:19:19 +01:00
|
|
|
---
|
2022-08-05 14:03:38 +02:00
|
|
|
# Copyright (c) Ansible Project
|
|
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-01-28 08:19:19 +01:00
|
|
|
examples:
|
2024-06-13 07:19:02 +02:00
|
|
|
- title: Two lists
|
|
|
|
description: 'In the example below the lists are merged by the attribute ``name``:'
|
2022-02-05 21:20:15 +01:00
|
|
|
file: example-001_vars/list3.yml
|
|
|
|
lang: 'yaml+jinja'
|
2024-06-13 07:19:02 +02:00
|
|
|
- title:
|
|
|
|
description: 'This produces:'
|
2022-02-05 21:20:15 +01:00
|
|
|
file: example-001.out
|
|
|
|
lang: 'yaml'
|
2024-06-13 07:19:02 +02:00
|
|
|
- title: List of two lists
|
|
|
|
description: 'It is possible to use a list of lists as an input of the filter:'
|
2022-02-05 21:20:15 +01:00
|
|
|
file: example-002_vars/list3.yml
|
|
|
|
lang: 'yaml+jinja'
|
2024-06-13 07:19:02 +02:00
|
|
|
- title:
|
|
|
|
description: 'This produces the same result as in the previous example:'
|
2022-02-05 21:20:15 +01:00
|
|
|
file: example-002.out
|
|
|
|
lang: 'yaml'
|
2024-06-13 07:19:02 +02:00
|
|
|
- title: Single list
|
|
|
|
description: 'It is possible to merge single list:'
|
|
|
|
file: example-009_vars/list3.yml
|
|
|
|
lang: 'yaml+jinja'
|
|
|
|
- title:
|
|
|
|
description: 'This produces the same result as in the previous example:'
|
|
|
|
file: example-009.out
|
|
|
|
lang: 'yaml'
|
|
|
|
- title: list_merge=replace (default)
|
|
|
|
description: 'Example :ansopt:`community.general.lists_mergeby#filter:list_merge=replace` (default):'
|
2022-02-05 21:20:15 +01:00
|
|
|
file: example-003_vars/list3.yml
|
2022-01-28 08:19:19 +01:00
|
|
|
lang: 'yaml+jinja'
|
2024-06-13 07:19:02 +02:00
|
|
|
- title:
|
|
|
|
description: 'This produces:'
|
2022-01-28 08:19:19 +01:00
|
|
|
file: example-003.out
|
|
|
|
lang: 'yaml'
|
2024-06-13 07:19:02 +02:00
|
|
|
- title: list_merge=keep
|
|
|
|
description: 'Example :ansopt:`community.general.lists_mergeby#filter:list_merge=keep`:'
|
2022-02-05 21:20:15 +01:00
|
|
|
file: example-004_vars/list3.yml
|
2022-01-28 08:19:19 +01:00
|
|
|
lang: 'yaml+jinja'
|
2024-06-13 07:19:02 +02:00
|
|
|
- title:
|
|
|
|
description: 'This produces:'
|
2022-01-28 08:19:19 +01:00
|
|
|
file: example-004.out
|
|
|
|
lang: 'yaml'
|
2024-06-13 07:19:02 +02:00
|
|
|
- title: list_merge=append
|
|
|
|
description: 'Example :ansopt:`community.general.lists_mergeby#filter:list_merge=append`:'
|
2022-02-05 21:20:15 +01:00
|
|
|
file: example-005_vars/list3.yml
|
2022-01-28 08:19:19 +01:00
|
|
|
lang: 'yaml+jinja'
|
2024-06-13 07:19:02 +02:00
|
|
|
- title:
|
|
|
|
description: 'This produces:'
|
2022-01-28 08:19:19 +01:00
|
|
|
file: example-005.out
|
|
|
|
lang: 'yaml'
|
2024-06-13 07:19:02 +02:00
|
|
|
- title: list_merge=prepend
|
|
|
|
description: 'Example :ansopt:`community.general.lists_mergeby#filter:list_merge=prepend`:'
|
2022-02-05 21:20:15 +01:00
|
|
|
file: example-006_vars/list3.yml
|
2022-01-28 08:19:19 +01:00
|
|
|
lang: 'yaml+jinja'
|
2024-06-13 07:19:02 +02:00
|
|
|
- title:
|
|
|
|
description: 'This produces:'
|
2022-01-28 08:19:19 +01:00
|
|
|
file: example-006.out
|
|
|
|
lang: 'yaml'
|
2024-06-13 07:19:02 +02:00
|
|
|
- title: list_merge=append_rp
|
|
|
|
description: 'Example :ansopt:`community.general.lists_mergeby#filter:list_merge=append_rp`:'
|
2022-02-05 21:20:15 +01:00
|
|
|
file: example-007_vars/list3.yml
|
2022-01-28 08:19:19 +01:00
|
|
|
lang: 'yaml+jinja'
|
2024-06-13 07:19:02 +02:00
|
|
|
- title:
|
|
|
|
description: 'This produces:'
|
2022-01-28 08:19:19 +01:00
|
|
|
file: example-007.out
|
|
|
|
lang: 'yaml'
|
2024-06-13 07:19:02 +02:00
|
|
|
- title: list_merge=prepend_rp
|
|
|
|
description: 'Example :ansopt:`community.general.lists_mergeby#filter:list_merge=prepend_rp`:'
|
2022-02-05 21:20:15 +01:00
|
|
|
file: example-008_vars/list3.yml
|
2022-01-28 08:19:19 +01:00
|
|
|
lang: 'yaml+jinja'
|
2024-06-13 07:19:02 +02:00
|
|
|
- title:
|
|
|
|
description: 'This produces:'
|
2022-01-28 08:19:19 +01:00
|
|
|
file: example-008.out
|
|
|
|
lang: 'yaml'
|