From 504749b4e540ef823b78179bb787f09ef8bbcaed Mon Sep 17 00:00:00 2001 From: Vladimir Botka Date: Tue, 16 Jul 2024 14:55:13 +0200 Subject: [PATCH] Docs. Remove helpers. --- docs/docsite/helper/keep_keys/README.md | 61 ---------- ...ons-lists_of_dictionaries-keep_keys.rst.j2 | 80 ------------- .../helper/keep_keys/keep_keys.rst.sha1 | 1 - .../keep_keys/keep_keys.rst.sha1.license | 3 - docs/docsite/helper/keep_keys/playbook.yml | 79 ------------- docs/docsite/helper/keep_keys/tests.yml.sha1 | 1 - .../helper/keep_keys/tests.yml.sha1.license | 3 - .../helper/lists_mergeby/default-common.yml | 12 -- .../lists_mergeby/default-recursive-true.yml | 21 ---- .../helper/lists_mergeby/example-001.yml | 14 --- .../example-001_vars/default-common.yml | 1 - .../lists_mergeby/example-001_vars/list3.yml | 6 - .../helper/lists_mergeby/example-002.yml | 14 --- .../example-002_vars/default-common.yml | 1 - .../lists_mergeby/example-002_vars/list3.yml | 6 - .../helper/lists_mergeby/example-003.yml | 14 --- .../default-recursive-true.yml | 1 - .../lists_mergeby/example-003_vars/list3.yml | 7 -- .../helper/lists_mergeby/example-004.yml | 14 --- .../default-recursive-true.yml | 1 - .../lists_mergeby/example-004_vars/list3.yml | 8 -- .../helper/lists_mergeby/example-005.yml | 14 --- .../default-recursive-true.yml | 1 - .../lists_mergeby/example-005_vars/list3.yml | 8 -- .../helper/lists_mergeby/example-006.yml | 14 --- .../default-recursive-true.yml | 1 - .../lists_mergeby/example-006_vars/list3.yml | 8 -- .../helper/lists_mergeby/example-007.yml | 14 --- .../default-recursive-true.yml | 1 - .../lists_mergeby/example-007_vars/list3.yml | 8 -- .../helper/lists_mergeby/example-008.yml | 14 --- .../default-recursive-true.yml | 1 - .../lists_mergeby/example-008_vars/list3.yml | 8 -- .../helper/lists_mergeby/example-009.yml | 14 --- .../example-009_vars/default-common.yml | 1 - .../lists_mergeby/example-009_vars/list3.yml | 6 - .../docsite/helper/lists_mergeby/examples.yml | 78 ------------- .../helper/lists_mergeby/examples_all.rst.j2 | 13 --- .../helper/lists_mergeby/extra-vars.yml | 7 -- ...tions_merging_lists_of_dictionaries.rst.j2 | 74 ------------ .../docsite/helper/lists_mergeby/list3.out.j2 | 7 -- .../docsite/helper/lists_mergeby/playbook.yml | 64 ---------- docs/docsite/helper/remove_keys/README.md | 61 ---------- ...s-lists_of_dictionaries-remove_keys.rst.j2 | 80 ------------- docs/docsite/helper/remove_keys/playbook.yml | 79 ------------- .../helper/remove_keys/remove_keys.rst.sha1 | 1 - .../remove_keys/remove_keys.rst.sha1.license | 3 - .../docsite/helper/remove_keys/tests.yml.sha1 | 1 - .../helper/remove_keys/tests.yml.sha1.license | 3 - docs/docsite/helper/replace_keys/README.md | 61 ---------- ...-lists_of_dictionaries-replace_keys.rst.j2 | 110 ------------------ docs/docsite/helper/replace_keys/playbook.yml | 79 ------------- .../helper/replace_keys/replace_keys.rst.sha1 | 1 - .../replace_keys.rst.sha1.license | 3 - .../helper/replace_keys/tests.yml.sha1 | 1 - .../replace_keys/tests.yml.sha1.license | 3 - 56 files changed, 1190 deletions(-) delete mode 100644 docs/docsite/helper/keep_keys/README.md delete mode 100644 docs/docsite/helper/keep_keys/filter_guide-abstract_informations-lists_of_dictionaries-keep_keys.rst.j2 delete mode 100644 docs/docsite/helper/keep_keys/keep_keys.rst.sha1 delete mode 100644 docs/docsite/helper/keep_keys/keep_keys.rst.sha1.license delete mode 100644 docs/docsite/helper/keep_keys/playbook.yml delete mode 100644 docs/docsite/helper/keep_keys/tests.yml.sha1 delete mode 100644 docs/docsite/helper/keep_keys/tests.yml.sha1.license delete mode 100644 docs/docsite/helper/lists_mergeby/default-common.yml delete mode 100644 docs/docsite/helper/lists_mergeby/default-recursive-true.yml delete mode 100644 docs/docsite/helper/lists_mergeby/example-001.yml delete mode 120000 docs/docsite/helper/lists_mergeby/example-001_vars/default-common.yml delete mode 100644 docs/docsite/helper/lists_mergeby/example-001_vars/list3.yml delete mode 100644 docs/docsite/helper/lists_mergeby/example-002.yml delete mode 120000 docs/docsite/helper/lists_mergeby/example-002_vars/default-common.yml delete mode 100644 docs/docsite/helper/lists_mergeby/example-002_vars/list3.yml delete mode 100644 docs/docsite/helper/lists_mergeby/example-003.yml delete mode 120000 docs/docsite/helper/lists_mergeby/example-003_vars/default-recursive-true.yml delete mode 100644 docs/docsite/helper/lists_mergeby/example-003_vars/list3.yml delete mode 100644 docs/docsite/helper/lists_mergeby/example-004.yml delete mode 120000 docs/docsite/helper/lists_mergeby/example-004_vars/default-recursive-true.yml delete mode 100644 docs/docsite/helper/lists_mergeby/example-004_vars/list3.yml delete mode 100644 docs/docsite/helper/lists_mergeby/example-005.yml delete mode 120000 docs/docsite/helper/lists_mergeby/example-005_vars/default-recursive-true.yml delete mode 100644 docs/docsite/helper/lists_mergeby/example-005_vars/list3.yml delete mode 100644 docs/docsite/helper/lists_mergeby/example-006.yml delete mode 120000 docs/docsite/helper/lists_mergeby/example-006_vars/default-recursive-true.yml delete mode 100644 docs/docsite/helper/lists_mergeby/example-006_vars/list3.yml delete mode 100644 docs/docsite/helper/lists_mergeby/example-007.yml delete mode 120000 docs/docsite/helper/lists_mergeby/example-007_vars/default-recursive-true.yml delete mode 100644 docs/docsite/helper/lists_mergeby/example-007_vars/list3.yml delete mode 100644 docs/docsite/helper/lists_mergeby/example-008.yml delete mode 120000 docs/docsite/helper/lists_mergeby/example-008_vars/default-recursive-true.yml delete mode 100644 docs/docsite/helper/lists_mergeby/example-008_vars/list3.yml delete mode 100644 docs/docsite/helper/lists_mergeby/example-009.yml delete mode 120000 docs/docsite/helper/lists_mergeby/example-009_vars/default-common.yml delete mode 100644 docs/docsite/helper/lists_mergeby/example-009_vars/list3.yml delete mode 100644 docs/docsite/helper/lists_mergeby/examples.yml delete mode 100644 docs/docsite/helper/lists_mergeby/examples_all.rst.j2 delete mode 100644 docs/docsite/helper/lists_mergeby/extra-vars.yml delete mode 100644 docs/docsite/helper/lists_mergeby/filter_guide_abstract_informations_merging_lists_of_dictionaries.rst.j2 delete mode 100644 docs/docsite/helper/lists_mergeby/list3.out.j2 delete mode 100644 docs/docsite/helper/lists_mergeby/playbook.yml delete mode 100644 docs/docsite/helper/remove_keys/README.md delete mode 100644 docs/docsite/helper/remove_keys/filter_guide-abstract_informations-lists_of_dictionaries-remove_keys.rst.j2 delete mode 100644 docs/docsite/helper/remove_keys/playbook.yml delete mode 100644 docs/docsite/helper/remove_keys/remove_keys.rst.sha1 delete mode 100644 docs/docsite/helper/remove_keys/remove_keys.rst.sha1.license delete mode 100644 docs/docsite/helper/remove_keys/tests.yml.sha1 delete mode 100644 docs/docsite/helper/remove_keys/tests.yml.sha1.license delete mode 100644 docs/docsite/helper/replace_keys/README.md delete mode 100644 docs/docsite/helper/replace_keys/filter_guide-abstract_informations-lists_of_dictionaries-replace_keys.rst.j2 delete mode 100644 docs/docsite/helper/replace_keys/playbook.yml delete mode 100644 docs/docsite/helper/replace_keys/replace_keys.rst.sha1 delete mode 100644 docs/docsite/helper/replace_keys/replace_keys.rst.sha1.license delete mode 100644 docs/docsite/helper/replace_keys/tests.yml.sha1 delete mode 100644 docs/docsite/helper/replace_keys/tests.yml.sha1.license diff --git a/docs/docsite/helper/keep_keys/README.md b/docs/docsite/helper/keep_keys/README.md deleted file mode 100644 index 69a4076ef9..0000000000 --- a/docs/docsite/helper/keep_keys/README.md +++ /dev/null @@ -1,61 +0,0 @@ - - -# Docs helper. Create RST file. - -The playbook `playbook.yml` writes a RST file that can be used in -docs/docsite/rst. The usage of this helper is recommended but not -mandatory. You can stop reading here and update the RST file manually -if you don't want to use this helper. - -## Run the playbook - -If you want to generate the RST file by this helper fit the variables -in the playbook and the template to your needs. Then, run the play - -```sh -shell> ansible-playbook playbook.yml -``` - -## Copy RST to docs/docsite/rst - -Copy the RST file to `docs/docsite/rst` and remove it from this -directory. - -## Update the checksums - -Substitute the variables and run the below commands - -```sh -shell> sha1sum {{ target_vars }} > {{ target_sha1 }} -shell> sha1sum {{ file_rst }} > {{ file_sha1 }} -``` - -## Playbook explained - -The playbook includes the variable *tests* from the integration tests -and creates the RST file from the template. The playbook will -terminate if: - -* The file with the variable *tests* was changed -* The RST file was changed - -This means that this helper is probably not up to date. - -### The file with the variable *tests* was changed - -This means that somebody updated the integration tests. Review the -changes and update the template if needed. Update the checksum to pass -the integrity test. The playbook message provides you with the -command. - -### The RST file was changed - -This means that somebody updated the RST file manually. Review the -changes and update the template. Update the checksum to pass the -integrity test. The playbook message provides you with the -command. Make sure that the updated template will create identical RST -file. Only then apply your changes. diff --git a/docs/docsite/helper/keep_keys/filter_guide-abstract_informations-lists_of_dictionaries-keep_keys.rst.j2 b/docs/docsite/helper/keep_keys/filter_guide-abstract_informations-lists_of_dictionaries-keep_keys.rst.j2 deleted file mode 100644 index 77281549ba..0000000000 --- a/docs/docsite/helper/keep_keys/filter_guide-abstract_informations-lists_of_dictionaries-keep_keys.rst.j2 +++ /dev/null @@ -1,80 +0,0 @@ -.. - 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 - -keep_keys -""""""""" - -Use the filter :ansplugin:`community.general.keep_keys#filter` if you have a list of dictionaries and want to keep certain keys only. - -.. note:: The output of the examples in this section use the YAML callback plugin. Quoting: "Ansible output that can be quite a bit easier to read than the default JSON formatting." See :ansplugin:`the documentation for the community.general.yaml callback plugin `. - - -Let us use the below list in the following examples: - -.. code-block:: yaml - - input: - {{ tests.0.input | to_yaml(indent=2) | indent(5) }} - -{% for i in tests[0:1]|subelements('group') %} -* {{ i.1.d }} - -.. code-block:: yaml+jinja - :emphasize-lines: 1 - - target: {{ i.1.tt }} - result: "{{ lookup('file', target ~ '/templates/' ~ i.0.template) }}" - -{% endfor %} - -gives - -.. code-block:: yaml - :emphasize-lines: 1- - - result: - {{ tests.0.result | to_yaml(indent=2) | indent(5) }} - -.. versionadded:: 9.1.0 - -* The results of the below examples 1-5 are all the same: - -.. code-block:: yaml - :emphasize-lines: 1- - - result: - {{ tests.1.result | to_yaml(indent=2) | indent(5) }} - -{% for i in tests[1:2]|subelements('group') %} -{{ loop.index }}. {{ i.1.d }} - -.. code-block:: yaml+jinja - :emphasize-lines: 1,2 - - mp: {{ i.1.mp }} - target: {{ i.1.tt }} - result: "{{ lookup('file', target ~ '/templates/' ~ i.0.template) }}" - -{% endfor %} - -* The results of the below examples 6-9 are all the same: - -.. code-block:: yaml - :emphasize-lines: 1- - - result: - {{ tests.2.result | to_yaml(indent=2) | indent(5) }} - -{% for i in tests[2:3]|subelements('group') %} -{{ loop.index + 5 }}. {{ i.1.d }} - -.. code-block:: yaml+jinja - :emphasize-lines: 1,2 - - mp: {{ i.1.mp }} - target: {{ i.1.tt }} - result: "{{ lookup('file', target ~ '/templates/' ~ i.0.template) }}" - -{% endfor %} diff --git a/docs/docsite/helper/keep_keys/keep_keys.rst.sha1 b/docs/docsite/helper/keep_keys/keep_keys.rst.sha1 deleted file mode 100644 index 532c6a192c..0000000000 --- a/docs/docsite/helper/keep_keys/keep_keys.rst.sha1 +++ /dev/null @@ -1 +0,0 @@ -8690afce792abc95693c2f61f743ee27388b1592 ../../rst/filter_guide-abstract_informations-lists_of_dictionaries-keep_keys.rst diff --git a/docs/docsite/helper/keep_keys/keep_keys.rst.sha1.license b/docs/docsite/helper/keep_keys/keep_keys.rst.sha1.license deleted file mode 100644 index a1390a69ed..0000000000 --- a/docs/docsite/helper/keep_keys/keep_keys.rst.sha1.license +++ /dev/null @@ -1,3 +0,0 @@ -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 diff --git a/docs/docsite/helper/keep_keys/playbook.yml b/docs/docsite/helper/keep_keys/playbook.yml deleted file mode 100644 index 75ef90385b..0000000000 --- a/docs/docsite/helper/keep_keys/playbook.yml +++ /dev/null @@ -1,79 +0,0 @@ ---- -# 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 - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Create docs REST files -# shell> ansible-playbook playbook.yml -# -# Proofread and copy created *.rst file into the directory -# docs/docsite/rst. Do not add *.rst in this directory to the version -# control. -# -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# community.general/docs/docsite/helper/keep_keys/playbook.yml - -- name: Create RST file for docs/docsite/rst - hosts: localhost - gather_facts: false - - vars: - - plugin: keep_keys - plugin_type: filter - docs_path: - - filter_guide - - abstract_informations - - lists_of_dictionaries - - file_base: "{{ (docs_path + [plugin]) | join('-') }}" - file_rst: ../../rst/{{ file_base }}.rst - file_sha1: "{{ plugin }}.rst.sha1" - - target: "../../../../tests/integration/targets/{{ plugin_type }}_{{ plugin }}" - target_vars: "{{ target }}/vars/main/tests.yml" - target_sha1: tests.yml.sha1 - - tasks: - - - name: Test integrity tests.yml - when: - - integrity | d(true) | bool - - lookup('file', target_sha1) != lookup('pipe', 'sha1sum ' ~ target_vars) - block: - - - name: Changed tests.yml - ansible.builtin.debug: - msg: | - Changed {{ target_vars }} - Review the changes and update {{ target_sha1 }} - shell> sha1sum {{ target_vars }} > {{ target_sha1 }} - - - name: Changed tests.yml end host - ansible.builtin.meta: end_play - - - name: Test integrity RST file - when: - - integrity | d(true) | bool - - lookup('file', file_sha1) != lookup('pipe', 'sha1sum ' ~ file_rst) - block: - - - name: Changed RST file - ansible.builtin.debug: - msg: | - Changed {{ file_rst }} - Review the changes and update {{ file_sha1 }} - shell> sha1sum {{ file_rst }} > {{ file_sha1 }} - - - name: Changed RST file end host - ansible.builtin.meta: end_play - - - name: Include target vars - include_vars: - file: "{{ target_vars }}" - - - name: Create RST file - ansible.builtin.template: - src: "{{ file_base }}.rst.j2" - dest: "{{ file_base }}.rst" diff --git a/docs/docsite/helper/keep_keys/tests.yml.sha1 b/docs/docsite/helper/keep_keys/tests.yml.sha1 deleted file mode 100644 index fcf41a4347..0000000000 --- a/docs/docsite/helper/keep_keys/tests.yml.sha1 +++ /dev/null @@ -1 +0,0 @@ -c6fc4ee2017d9222675bcd13cc4f88ba8d14f38d ../../../../tests/integration/targets/filter_keep_keys/vars/main/tests.yml diff --git a/docs/docsite/helper/keep_keys/tests.yml.sha1.license b/docs/docsite/helper/keep_keys/tests.yml.sha1.license deleted file mode 100644 index a1390a69ed..0000000000 --- a/docs/docsite/helper/keep_keys/tests.yml.sha1.license +++ /dev/null @@ -1,3 +0,0 @@ -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 diff --git a/docs/docsite/helper/lists_mergeby/default-common.yml b/docs/docsite/helper/lists_mergeby/default-common.yml deleted file mode 100644 index 4431fe27dc..0000000000 --- a/docs/docsite/helper/lists_mergeby/default-common.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -# 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 -list1: - - {name: foo, extra: true} - - {name: bar, extra: false} - - {name: meh, extra: true} - -list2: - - {name: foo, path: /foo} - - {name: baz, path: /baz} diff --git a/docs/docsite/helper/lists_mergeby/default-recursive-true.yml b/docs/docsite/helper/lists_mergeby/default-recursive-true.yml deleted file mode 100644 index eb83ea82e1..0000000000 --- a/docs/docsite/helper/lists_mergeby/default-recursive-true.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -# 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 -list1: - - name: myname01 - param01: - x: default_value - y: default_value - list: [default_value] - - name: myname02 - param01: [1, 1, 2, 3] - -list2: - - name: myname01 - param01: - y: patch_value - z: patch_value - list: [patch_value] - - name: myname02 - param01: [3, 4, 4] diff --git a/docs/docsite/helper/lists_mergeby/example-001.yml b/docs/docsite/helper/lists_mergeby/example-001.yml deleted file mode 100644 index c27b019e52..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-001.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -# 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 - -- name: 1. Merge two lists by common attribute 'name' - include_vars: - dir: example-001_vars -- debug: - var: list3 - when: debug | d(false) | bool -- template: - src: list3.out.j2 - dest: example-001.out diff --git a/docs/docsite/helper/lists_mergeby/example-001_vars/default-common.yml b/docs/docsite/helper/lists_mergeby/example-001_vars/default-common.yml deleted file mode 120000 index 7ea8984a8d..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-001_vars/default-common.yml +++ /dev/null @@ -1 +0,0 @@ -../default-common.yml \ No newline at end of file diff --git a/docs/docsite/helper/lists_mergeby/example-001_vars/list3.yml b/docs/docsite/helper/lists_mergeby/example-001_vars/list3.yml deleted file mode 100644 index 8bd8bc8f24..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-001_vars/list3.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -# 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 -list3: "{{ list1 | - community.general.lists_mergeby(list2, 'name') }}" diff --git a/docs/docsite/helper/lists_mergeby/example-002.yml b/docs/docsite/helper/lists_mergeby/example-002.yml deleted file mode 100644 index e164db1251..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-002.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -# 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 - -- name: 2. Merge two lists by common attribute 'name' - include_vars: - dir: example-002_vars -- debug: - var: list3 - when: debug | d(false) | bool -- template: - src: list3.out.j2 - dest: example-002.out diff --git a/docs/docsite/helper/lists_mergeby/example-002_vars/default-common.yml b/docs/docsite/helper/lists_mergeby/example-002_vars/default-common.yml deleted file mode 120000 index 7ea8984a8d..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-002_vars/default-common.yml +++ /dev/null @@ -1 +0,0 @@ -../default-common.yml \ No newline at end of file diff --git a/docs/docsite/helper/lists_mergeby/example-002_vars/list3.yml b/docs/docsite/helper/lists_mergeby/example-002_vars/list3.yml deleted file mode 100644 index be6cfcbf31..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-002_vars/list3.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -# 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 -list3: "{{ [list1, list2] | - community.general.lists_mergeby('name') }}" diff --git a/docs/docsite/helper/lists_mergeby/example-003.yml b/docs/docsite/helper/lists_mergeby/example-003.yml deleted file mode 100644 index cbc5e43a50..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-003.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -# 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 - -- name: 3. Merge recursive by 'name', replace lists (default) - include_vars: - dir: example-003_vars -- debug: - var: list3 - when: debug | d(false) | bool -- template: - src: list3.out.j2 - dest: example-003.out diff --git a/docs/docsite/helper/lists_mergeby/example-003_vars/default-recursive-true.yml b/docs/docsite/helper/lists_mergeby/example-003_vars/default-recursive-true.yml deleted file mode 120000 index 299736f8ad..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-003_vars/default-recursive-true.yml +++ /dev/null @@ -1 +0,0 @@ -../default-recursive-true.yml \ No newline at end of file diff --git a/docs/docsite/helper/lists_mergeby/example-003_vars/list3.yml b/docs/docsite/helper/lists_mergeby/example-003_vars/list3.yml deleted file mode 100644 index 2eff5df41a..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-003_vars/list3.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# 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 -list3: "{{ [list1, list2] | - community.general.lists_mergeby('name', - recursive=true) }}" diff --git a/docs/docsite/helper/lists_mergeby/example-004.yml b/docs/docsite/helper/lists_mergeby/example-004.yml deleted file mode 100644 index 68e77dea81..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-004.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -# 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 - -- name: 4. Merge recursive by 'name', keep lists - include_vars: - dir: example-004_vars -- debug: - var: list3 - when: debug | d(false) | bool -- template: - src: list3.out.j2 - dest: example-004.out diff --git a/docs/docsite/helper/lists_mergeby/example-004_vars/default-recursive-true.yml b/docs/docsite/helper/lists_mergeby/example-004_vars/default-recursive-true.yml deleted file mode 120000 index 299736f8ad..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-004_vars/default-recursive-true.yml +++ /dev/null @@ -1 +0,0 @@ -../default-recursive-true.yml \ No newline at end of file diff --git a/docs/docsite/helper/lists_mergeby/example-004_vars/list3.yml b/docs/docsite/helper/lists_mergeby/example-004_vars/list3.yml deleted file mode 100644 index 94c8ceed38..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-004_vars/list3.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -# 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 -list3: "{{ [list1, list2] | - community.general.lists_mergeby('name', - recursive=true, - list_merge='keep') }}" diff --git a/docs/docsite/helper/lists_mergeby/example-005.yml b/docs/docsite/helper/lists_mergeby/example-005.yml deleted file mode 100644 index b7b81de294..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-005.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -# 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 - -- name: 5. Merge recursive by 'name', append lists - include_vars: - dir: example-005_vars -- debug: - var: list3 - when: debug | d(false) | bool -- template: - src: list3.out.j2 - dest: example-005.out diff --git a/docs/docsite/helper/lists_mergeby/example-005_vars/default-recursive-true.yml b/docs/docsite/helper/lists_mergeby/example-005_vars/default-recursive-true.yml deleted file mode 120000 index 299736f8ad..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-005_vars/default-recursive-true.yml +++ /dev/null @@ -1 +0,0 @@ -../default-recursive-true.yml \ No newline at end of file diff --git a/docs/docsite/helper/lists_mergeby/example-005_vars/list3.yml b/docs/docsite/helper/lists_mergeby/example-005_vars/list3.yml deleted file mode 100644 index f0d7751f22..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-005_vars/list3.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -# 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 -list3: "{{ [list1, list2] | - community.general.lists_mergeby('name', - recursive=true, - list_merge='append') }}" diff --git a/docs/docsite/helper/lists_mergeby/example-006.yml b/docs/docsite/helper/lists_mergeby/example-006.yml deleted file mode 100644 index 1be3becbc0..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-006.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -# 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 - -- name: 6. Merge recursive by 'name', prepend lists - include_vars: - dir: example-006_vars -- debug: - var: list3 - when: debug | d(false) | bool -- template: - src: list3.out.j2 - dest: example-006.out diff --git a/docs/docsite/helper/lists_mergeby/example-006_vars/default-recursive-true.yml b/docs/docsite/helper/lists_mergeby/example-006_vars/default-recursive-true.yml deleted file mode 120000 index 299736f8ad..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-006_vars/default-recursive-true.yml +++ /dev/null @@ -1 +0,0 @@ -../default-recursive-true.yml \ No newline at end of file diff --git a/docs/docsite/helper/lists_mergeby/example-006_vars/list3.yml b/docs/docsite/helper/lists_mergeby/example-006_vars/list3.yml deleted file mode 100644 index f555c8dcb2..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-006_vars/list3.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -# 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 -list3: "{{ [list1, list2] | - community.general.lists_mergeby('name', - recursive=true, - list_merge='prepend') }}" diff --git a/docs/docsite/helper/lists_mergeby/example-007.yml b/docs/docsite/helper/lists_mergeby/example-007.yml deleted file mode 100644 index 8a596ea68e..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-007.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -# 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 - -- name: 7. Merge recursive by 'name', append lists 'remove present' - include_vars: - dir: example-007_vars -- debug: - var: list3 - when: debug|d(false) | bool -- template: - src: list3.out.j2 - dest: example-007.out diff --git a/docs/docsite/helper/lists_mergeby/example-007_vars/default-recursive-true.yml b/docs/docsite/helper/lists_mergeby/example-007_vars/default-recursive-true.yml deleted file mode 120000 index 299736f8ad..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-007_vars/default-recursive-true.yml +++ /dev/null @@ -1 +0,0 @@ -../default-recursive-true.yml \ No newline at end of file diff --git a/docs/docsite/helper/lists_mergeby/example-007_vars/list3.yml b/docs/docsite/helper/lists_mergeby/example-007_vars/list3.yml deleted file mode 100644 index d8ad16cf4d..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-007_vars/list3.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -# 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 -list3: "{{ [list1, list2] | - community.general.lists_mergeby('name', - recursive=true, - list_merge='append_rp') }}" diff --git a/docs/docsite/helper/lists_mergeby/example-008.yml b/docs/docsite/helper/lists_mergeby/example-008.yml deleted file mode 100644 index 6d5c03bc6d..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-008.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -# 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 - -- name: 8. Merge recursive by 'name', prepend lists 'remove present' - include_vars: - dir: example-008_vars -- debug: - var: list3 - when: debug | d(false) | bool -- template: - src: list3.out.j2 - dest: example-008.out diff --git a/docs/docsite/helper/lists_mergeby/example-008_vars/default-recursive-true.yml b/docs/docsite/helper/lists_mergeby/example-008_vars/default-recursive-true.yml deleted file mode 120000 index 299736f8ad..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-008_vars/default-recursive-true.yml +++ /dev/null @@ -1 +0,0 @@ -../default-recursive-true.yml \ No newline at end of file diff --git a/docs/docsite/helper/lists_mergeby/example-008_vars/list3.yml b/docs/docsite/helper/lists_mergeby/example-008_vars/list3.yml deleted file mode 100644 index b2051376ea..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-008_vars/list3.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -# 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 -list3: "{{ [list1, list2] | - community.general.lists_mergeby('name', - recursive=true, - list_merge='prepend_rp') }}" diff --git a/docs/docsite/helper/lists_mergeby/example-009.yml b/docs/docsite/helper/lists_mergeby/example-009.yml deleted file mode 100644 index beef5d356c..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-009.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -# 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 - -- name: 9. Merge single list by common attribute 'name' - include_vars: - dir: example-009_vars -- debug: - var: list3 - when: debug | d(false) | bool -- template: - src: list3.out.j2 - dest: example-009.out diff --git a/docs/docsite/helper/lists_mergeby/example-009_vars/default-common.yml b/docs/docsite/helper/lists_mergeby/example-009_vars/default-common.yml deleted file mode 120000 index 7ea8984a8d..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-009_vars/default-common.yml +++ /dev/null @@ -1 +0,0 @@ -../default-common.yml \ No newline at end of file diff --git a/docs/docsite/helper/lists_mergeby/example-009_vars/list3.yml b/docs/docsite/helper/lists_mergeby/example-009_vars/list3.yml deleted file mode 100644 index 1708e3bafa..0000000000 --- a/docs/docsite/helper/lists_mergeby/example-009_vars/list3.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -# 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 -list3: "{{ [list1 + list2, []] | - community.general.lists_mergeby('name') }}" diff --git a/docs/docsite/helper/lists_mergeby/examples.yml b/docs/docsite/helper/lists_mergeby/examples.yml deleted file mode 100644 index 34ad2d1558..0000000000 --- a/docs/docsite/helper/lists_mergeby/examples.yml +++ /dev/null @@ -1,78 +0,0 @@ ---- -# 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 - -examples: - - title: Two lists - description: 'In the example below the lists are merged by the attribute ``name``:' - file: example-001_vars/list3.yml - lang: 'yaml+jinja' - - title: - description: 'This produces:' - file: example-001.out - lang: 'yaml' - - title: List of two lists - description: 'It is possible to use a list of lists as an input of the filter:' - file: example-002_vars/list3.yml - lang: 'yaml+jinja' - - title: - description: 'This produces the same result as in the previous example:' - file: example-002.out - lang: 'yaml' - - 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):' - file: example-003_vars/list3.yml - lang: 'yaml+jinja' - - title: - description: 'This produces:' - file: example-003.out - lang: 'yaml' - - title: list_merge=keep - description: 'Example :ansopt:`community.general.lists_mergeby#filter:list_merge=keep`:' - file: example-004_vars/list3.yml - lang: 'yaml+jinja' - - title: - description: 'This produces:' - file: example-004.out - lang: 'yaml' - - title: list_merge=append - description: 'Example :ansopt:`community.general.lists_mergeby#filter:list_merge=append`:' - file: example-005_vars/list3.yml - lang: 'yaml+jinja' - - title: - description: 'This produces:' - file: example-005.out - lang: 'yaml' - - title: list_merge=prepend - description: 'Example :ansopt:`community.general.lists_mergeby#filter:list_merge=prepend`:' - file: example-006_vars/list3.yml - lang: 'yaml+jinja' - - title: - description: 'This produces:' - file: example-006.out - lang: 'yaml' - - title: list_merge=append_rp - description: 'Example :ansopt:`community.general.lists_mergeby#filter:list_merge=append_rp`:' - file: example-007_vars/list3.yml - lang: 'yaml+jinja' - - title: - description: 'This produces:' - file: example-007.out - lang: 'yaml' - - title: list_merge=prepend_rp - description: 'Example :ansopt:`community.general.lists_mergeby#filter:list_merge=prepend_rp`:' - file: example-008_vars/list3.yml - lang: 'yaml+jinja' - - title: - description: 'This produces:' - file: example-008.out - lang: 'yaml' diff --git a/docs/docsite/helper/lists_mergeby/examples_all.rst.j2 b/docs/docsite/helper/lists_mergeby/examples_all.rst.j2 deleted file mode 100644 index 88098683b9..0000000000 --- a/docs/docsite/helper/lists_mergeby/examples_all.rst.j2 +++ /dev/null @@ -1,13 +0,0 @@ -.. - 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 - -{% for i in examples %} -{{ i.description }} - -.. code-block:: {{ i.lang }} - - {{ lookup('file', i.file) | split('\n') | reject('match', '^(#|---)') | join ('\n') | indent(2) }} - -{% endfor %} diff --git a/docs/docsite/helper/lists_mergeby/extra-vars.yml b/docs/docsite/helper/lists_mergeby/extra-vars.yml deleted file mode 100644 index 0482c7ff29..0000000000 --- a/docs/docsite/helper/lists_mergeby/extra-vars.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# 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 -examples_one: true -examples_all: true -merging_lists_of_dictionaries: true diff --git a/docs/docsite/helper/lists_mergeby/filter_guide_abstract_informations_merging_lists_of_dictionaries.rst.j2 b/docs/docsite/helper/lists_mergeby/filter_guide_abstract_informations_merging_lists_of_dictionaries.rst.j2 deleted file mode 100644 index ad74161dcd..0000000000 --- a/docs/docsite/helper/lists_mergeby/filter_guide_abstract_informations_merging_lists_of_dictionaries.rst.j2 +++ /dev/null @@ -1,74 +0,0 @@ -.. - 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 - -Merging lists of dictionaries -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -If you have two or more lists of dictionaries and want to combine them into a list of merged dictionaries, where the dictionaries are merged by an attribute, you can use the :ansplugin:`community.general.lists_mergeby ` filter. - -.. note:: The output of the examples in this section use the YAML callback plugin. Quoting: "Ansible output that can be quite a bit easier to read than the default JSON formatting." See the documentation for the :ansplugin:`community.general.yaml callback plugin `. - -Let us use the lists below in the following examples: - -.. code-block:: yaml - - {{ lookup('file', 'default-common.yml') | split('\n') | reject('match', '^(#|---)') | join ('\n') | indent(2) }} - -{% for i in examples[0:2] %} -{% if i.title | d('', true) | length > 0 %} -{{ i.title }} -{{ "%s" % ('"' * i.title|length) }} -{% endif %} -{{ i.description }} - -.. code-block:: {{ i.lang }} - - {{ lookup('file', i.file) | split('\n') | reject('match', '^(#|---)') | join ('\n') | indent(2) }} - -{% endfor %} - -.. versionadded:: 2.0.0 - -{% for i in examples[2:6] %} -{% if i.title | d('', true) | length > 0 %} -{{ i.title }} -{{ "%s" % ('"' * i.title|length) }} -{% endif %} -{{ i.description }} - -.. code-block:: {{ i.lang }} - - {{ lookup('file', i.file) | split('\n') | reject('match', '^(#|---)') | join ('\n') | indent(2) }} - -{% endfor %} - -The filter also accepts two optional parameters: :ansopt:`community.general.lists_mergeby#filter:recursive` and :ansopt:`community.general.lists_mergeby#filter:list_merge`. This is available since community.general 4.4.0. - -**recursive** - Is a boolean, default to ``false``. Should the :ansplugin:`community.general.lists_mergeby#filter` filter recursively merge nested hashes. Note: It does not depend on the value of the ``hash_behaviour`` setting in ``ansible.cfg``. - -**list_merge** - Is a string, its possible values are :ansval:`replace` (default), :ansval:`keep`, :ansval:`append`, :ansval:`prepend`, :ansval:`append_rp` or :ansval:`prepend_rp`. It modifies the behaviour of :ansplugin:`community.general.lists_mergeby#filter` when the hashes to merge contain arrays/lists. - -The examples below set :ansopt:`community.general.lists_mergeby#filter:recursive=true` and display the differences among all six options of :ansopt:`community.general.lists_mergeby#filter:list_merge`. Functionality of the parameters is exactly the same as in the filter :ansplugin:`ansible.builtin.combine#filter`. See :ref:`Combining hashes/dictionaries ` to learn details about these options. - -Let us use the lists below in the following examples - -.. code-block:: yaml - - {{ lookup('file', 'default-recursive-true.yml') | split('\n') | reject('match', '^(#|---)') | join ('\n') |indent(2) }} - -{% for i in examples[6:] %} -{% if i.title | d('', true) | length > 0 %} -{{ i.title }} -{{ "%s" % ('"' * i.title|length) }} -{% endif %} -{{ i.description }} - -.. code-block:: {{ i.lang }} - - {{ lookup('file', i.file) | split('\n') | reject('match', '^(#|---)') | join ('\n') |indent(2) }} - -{% endfor %} diff --git a/docs/docsite/helper/lists_mergeby/list3.out.j2 b/docs/docsite/helper/lists_mergeby/list3.out.j2 deleted file mode 100644 index a30a5c4ab0..0000000000 --- a/docs/docsite/helper/lists_mergeby/list3.out.j2 +++ /dev/null @@ -1,7 +0,0 @@ -{# -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 -#} -list3: - {{ list3 | to_yaml(indent=2, sort_keys=false) | indent(2) }} diff --git a/docs/docsite/helper/lists_mergeby/playbook.yml b/docs/docsite/helper/lists_mergeby/playbook.yml deleted file mode 100644 index ab389fa129..0000000000 --- a/docs/docsite/helper/lists_mergeby/playbook.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -# 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 - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# 1) Run all examples and create example-XXX.out -# shell> ansible-playbook playbook.yml -e examples_one=true -# -# 2) Optionally, for testing, create examples_all.rst -# shell> ansible-playbook playbook.yml -e examples_all=true -# -# 3) Create docs REST files -# shell> ansible-playbook playbook.yml -e merging_lists_of_dictionaries=true -# -# Notes: -# * Use YAML callback, e.g. set ANSIBLE_STDOUT_CALLBACK=community.general.yaml -# * Use sphinx-view to render and review the REST files -# shell> sphinx-view /examples_all.rst -# * Proofread and copy completed docs *.rst files into the directory rst. -# * Then delete the *.rst and *.out files from this directory. Do not -# add *.rst and *.out in this directory to the version control. -# -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# community.general/docs/docsite/helper/lists_mergeby/playbook.yml - -- hosts: localhost - gather_facts: false - tasks: - - - block: - - import_tasks: example-001.yml - tags: t001 - - import_tasks: example-002.yml - tags: t002 - - import_tasks: example-003.yml - tags: t003 - - import_tasks: example-004.yml - tags: t004 - - import_tasks: example-005.yml - tags: t005 - - import_tasks: example-006.yml - tags: t006 - - import_tasks: example-007.yml - tags: t007 - - import_tasks: example-008.yml - tags: t008 - - import_tasks: example-009.yml - tags: t009 - when: examples_one | d(false) | bool - - - block: - - include_vars: examples.yml - - template: - src: examples_all.rst.j2 - dest: examples_all.rst - when: examples_all | d(false) | bool - - - block: - - include_vars: examples.yml - - template: - src: filter_guide_abstract_informations_merging_lists_of_dictionaries.rst.j2 - dest: filter_guide_abstract_informations_merging_lists_of_dictionaries.rst - when: merging_lists_of_dictionaries | d(false) | bool diff --git a/docs/docsite/helper/remove_keys/README.md b/docs/docsite/helper/remove_keys/README.md deleted file mode 100644 index 69a4076ef9..0000000000 --- a/docs/docsite/helper/remove_keys/README.md +++ /dev/null @@ -1,61 +0,0 @@ - - -# Docs helper. Create RST file. - -The playbook `playbook.yml` writes a RST file that can be used in -docs/docsite/rst. The usage of this helper is recommended but not -mandatory. You can stop reading here and update the RST file manually -if you don't want to use this helper. - -## Run the playbook - -If you want to generate the RST file by this helper fit the variables -in the playbook and the template to your needs. Then, run the play - -```sh -shell> ansible-playbook playbook.yml -``` - -## Copy RST to docs/docsite/rst - -Copy the RST file to `docs/docsite/rst` and remove it from this -directory. - -## Update the checksums - -Substitute the variables and run the below commands - -```sh -shell> sha1sum {{ target_vars }} > {{ target_sha1 }} -shell> sha1sum {{ file_rst }} > {{ file_sha1 }} -``` - -## Playbook explained - -The playbook includes the variable *tests* from the integration tests -and creates the RST file from the template. The playbook will -terminate if: - -* The file with the variable *tests* was changed -* The RST file was changed - -This means that this helper is probably not up to date. - -### The file with the variable *tests* was changed - -This means that somebody updated the integration tests. Review the -changes and update the template if needed. Update the checksum to pass -the integrity test. The playbook message provides you with the -command. - -### The RST file was changed - -This means that somebody updated the RST file manually. Review the -changes and update the template. Update the checksum to pass the -integrity test. The playbook message provides you with the -command. Make sure that the updated template will create identical RST -file. Only then apply your changes. diff --git a/docs/docsite/helper/remove_keys/filter_guide-abstract_informations-lists_of_dictionaries-remove_keys.rst.j2 b/docs/docsite/helper/remove_keys/filter_guide-abstract_informations-lists_of_dictionaries-remove_keys.rst.j2 deleted file mode 100644 index 62b25c344c..0000000000 --- a/docs/docsite/helper/remove_keys/filter_guide-abstract_informations-lists_of_dictionaries-remove_keys.rst.j2 +++ /dev/null @@ -1,80 +0,0 @@ -.. - 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 - -remove_keys -""""""""""" - -Use the filter :ansplugin:`community.general.remove_keys#filter` if you have a list of dictionaries and want to remove certain keys. - -.. note:: The output of the examples in this section use the YAML callback plugin. Quoting: "Ansible output that can be quite a bit easier to read than the default JSON formatting." See See :ansplugin:`the documentation for the community.general.yaml callback plugin `. - - -Let us use the below list in the following examples: - -.. code-block:: yaml - - input: - {{ tests.0.input | to_yaml(indent=2) | indent(5) }} - -{% for i in tests[0:1]|subelements('group') %} -* {{ i.1.d }} - -.. code-block:: yaml+jinja - :emphasize-lines: 1 - - target: {{ i.1.tt }} - result: "{{ lookup('file', target ~ '/templates/' ~ i.0.template) }}" - -{% endfor %} - -gives - -.. code-block:: yaml - :emphasize-lines: 1- - - result: - {{ tests.0.result | to_yaml(indent=2) | indent(5) }} - -.. versionadded:: 9.1.0 - -* The results of the below examples 1-5 are all the same: - -.. code-block:: yaml - :emphasize-lines: 1- - - result: - {{ tests.1.result | to_yaml(indent=2) | indent(5) }} - -{% for i in tests[1:2]|subelements('group') %} -{{ loop.index }}. {{ i.1.d }} - -.. code-block:: yaml+jinja - :emphasize-lines: 1,2 - - mp: {{ i.1.mp }} - target: {{ i.1.tt }} - result: "{{ lookup('file', target ~ '/templates/' ~ i.0.template) }}" - -{% endfor %} - -* The results of the below examples 6-9 are all the same: - -.. code-block:: yaml - :emphasize-lines: 1- - - result: - {{ tests.2.result | to_yaml(indent=2) | indent(5) }} - -{% for i in tests[2:3]|subelements('group') %} -{{ loop.index + 5 }}. {{ i.1.d }} - -.. code-block:: yaml+jinja - :emphasize-lines: 1,2 - - mp: {{ i.1.mp }} - target: {{ i.1.tt }} - result: "{{ lookup('file', target ~ '/templates/' ~ i.0.template) }}" - -{% endfor %} diff --git a/docs/docsite/helper/remove_keys/playbook.yml b/docs/docsite/helper/remove_keys/playbook.yml deleted file mode 100644 index a2243d992e..0000000000 --- a/docs/docsite/helper/remove_keys/playbook.yml +++ /dev/null @@ -1,79 +0,0 @@ ---- -# 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 - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Create docs REST files -# shell> ansible-playbook playbook.yml -# -# Proofread and copy created *.rst file into the directory -# docs/docsite/rst. Do not add *.rst in this directory to the version -# control. -# -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# community.general/docs/docsite/helper/remove_keys/playbook.yml - -- name: Create RST file for docs/docsite/rst - hosts: localhost - gather_facts: false - - vars: - - plugin: remove_keys - plugin_type: filter - docs_path: - - filter_guide - - abstract_informations - - lists_of_dictionaries - - file_base: "{{ (docs_path + [plugin]) | join('-') }}" - file_rst: ../../rst/{{ file_base }}.rst - file_sha1: "{{ plugin }}.rst.sha1" - - target: "../../../../tests/integration/targets/{{ plugin_type }}_{{ plugin }}" - target_vars: "{{ target }}/vars/main/tests.yml" - target_sha1: tests.yml.sha1 - - tasks: - - - name: Test integrity tests.yml - when: - - integrity | d(true) | bool - - lookup('file', target_sha1) != lookup('pipe', 'sha1sum ' ~ target_vars) - block: - - - name: Changed tests.yml - ansible.builtin.debug: - msg: | - Changed {{ target_vars }} - Review the changes and update {{ target_sha1 }} - shell> sha1sum {{ target_vars }} > {{ target_sha1 }} - - - name: Changed tests.yml end host - ansible.builtin.meta: end_play - - - name: Test integrity RST file - when: - - integrity | d(true) | bool - - lookup('file', file_sha1) != lookup('pipe', 'sha1sum ' ~ file_rst) - block: - - - name: Changed RST file - ansible.builtin.debug: - msg: | - Changed {{ file_rst }} - Review the changes and update {{ file_sha1 }} - shell> sha1sum {{ file_rst }} > {{ file_sha1 }} - - - name: Changed RST file end host - ansible.builtin.meta: end_play - - - name: Include target vars - include_vars: - file: "{{ target_vars }}" - - - name: Create RST file - ansible.builtin.template: - src: "{{ file_base }}.rst.j2" - dest: "{{ file_base }}.rst" diff --git a/docs/docsite/helper/remove_keys/remove_keys.rst.sha1 b/docs/docsite/helper/remove_keys/remove_keys.rst.sha1 deleted file mode 100644 index a1c9e18210..0000000000 --- a/docs/docsite/helper/remove_keys/remove_keys.rst.sha1 +++ /dev/null @@ -1 +0,0 @@ -3cc606b42e3d450cf6323f25930f7c5a591fa086 ../../rst/filter_guide-abstract_informations-lists_of_dictionaries-remove_keys.rst diff --git a/docs/docsite/helper/remove_keys/remove_keys.rst.sha1.license b/docs/docsite/helper/remove_keys/remove_keys.rst.sha1.license deleted file mode 100644 index a1390a69ed..0000000000 --- a/docs/docsite/helper/remove_keys/remove_keys.rst.sha1.license +++ /dev/null @@ -1,3 +0,0 @@ -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 diff --git a/docs/docsite/helper/remove_keys/tests.yml.sha1 b/docs/docsite/helper/remove_keys/tests.yml.sha1 deleted file mode 100644 index 107a64d73c..0000000000 --- a/docs/docsite/helper/remove_keys/tests.yml.sha1 +++ /dev/null @@ -1 +0,0 @@ -0554335045f02d8c37b824355b0cf86864cee9a5 ../../../../tests/integration/targets/filter_remove_keys/vars/main/tests.yml diff --git a/docs/docsite/helper/remove_keys/tests.yml.sha1.license b/docs/docsite/helper/remove_keys/tests.yml.sha1.license deleted file mode 100644 index a1390a69ed..0000000000 --- a/docs/docsite/helper/remove_keys/tests.yml.sha1.license +++ /dev/null @@ -1,3 +0,0 @@ -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 diff --git a/docs/docsite/helper/replace_keys/README.md b/docs/docsite/helper/replace_keys/README.md deleted file mode 100644 index 69a4076ef9..0000000000 --- a/docs/docsite/helper/replace_keys/README.md +++ /dev/null @@ -1,61 +0,0 @@ - - -# Docs helper. Create RST file. - -The playbook `playbook.yml` writes a RST file that can be used in -docs/docsite/rst. The usage of this helper is recommended but not -mandatory. You can stop reading here and update the RST file manually -if you don't want to use this helper. - -## Run the playbook - -If you want to generate the RST file by this helper fit the variables -in the playbook and the template to your needs. Then, run the play - -```sh -shell> ansible-playbook playbook.yml -``` - -## Copy RST to docs/docsite/rst - -Copy the RST file to `docs/docsite/rst` and remove it from this -directory. - -## Update the checksums - -Substitute the variables and run the below commands - -```sh -shell> sha1sum {{ target_vars }} > {{ target_sha1 }} -shell> sha1sum {{ file_rst }} > {{ file_sha1 }} -``` - -## Playbook explained - -The playbook includes the variable *tests* from the integration tests -and creates the RST file from the template. The playbook will -terminate if: - -* The file with the variable *tests* was changed -* The RST file was changed - -This means that this helper is probably not up to date. - -### The file with the variable *tests* was changed - -This means that somebody updated the integration tests. Review the -changes and update the template if needed. Update the checksum to pass -the integrity test. The playbook message provides you with the -command. - -### The RST file was changed - -This means that somebody updated the RST file manually. Review the -changes and update the template. Update the checksum to pass the -integrity test. The playbook message provides you with the -command. Make sure that the updated template will create identical RST -file. Only then apply your changes. diff --git a/docs/docsite/helper/replace_keys/filter_guide-abstract_informations-lists_of_dictionaries-replace_keys.rst.j2 b/docs/docsite/helper/replace_keys/filter_guide-abstract_informations-lists_of_dictionaries-replace_keys.rst.j2 deleted file mode 100644 index fb0af32f2f..0000000000 --- a/docs/docsite/helper/replace_keys/filter_guide-abstract_informations-lists_of_dictionaries-replace_keys.rst.j2 +++ /dev/null @@ -1,110 +0,0 @@ -.. - 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 - -replace_keys -"""""""""""" - -Use the filter :ansplugin:`community.general.replace_keys#filter` if you have a list of dictionaries and want to replace certain keys. - -.. note:: The output of the examples in this section use the YAML callback plugin. Quoting: "Ansible output that can be quite a bit easier to read than the default JSON formatting." See :ansplugin:`the documentation for the community.general.yaml callback plugin `. - - -Let us use the below list in the following examples: - -.. code-block:: yaml - - input: - {{ tests.0.input | to_yaml(indent=2) | indent(5) }} - -{% for i in tests[0:1]|subelements('group') %} -* {{ i.1.d }} - -.. code-block:: yaml+jinja - :emphasize-lines: 1-3 - - target: - {{ i.1.tt | to_yaml(indent=2) | indent(5) }} - result: "{{ lookup('file', target ~ '/templates/' ~ i.0.template) }}" - -{% endfor %} - -gives - -.. code-block:: yaml - :emphasize-lines: 1- - - result: - {{ tests.0.result | to_yaml(indent=2) | indent(5) }} - -.. versionadded:: 9.1.0 - -* The results of the below examples 1-3 are all the same: - -.. code-block:: yaml - :emphasize-lines: 1- - - result: - {{ tests.1.result | to_yaml(indent=2) | indent(5) }} - -{% for i in tests[1:2]|subelements('group') %} -{{ loop.index }}. {{ i.1.d }} - -.. code-block:: yaml+jinja - :emphasize-lines: 1-4 - - mp: {{ i.1.mp }} - target: - {{ i.1.tt | to_yaml(indent=2) | indent(5) }} - result: "{{ lookup('file', target ~ '/templates/' ~ i.0.template) }}" - -{% endfor %} - -* The results of the below examples 4-5 are the same: - -.. code-block:: yaml - :emphasize-lines: 1- - - result: - {{ tests.2.result | to_yaml(indent=2) | indent(5) }} - -{% for i in tests[2:3]|subelements('group') %} -{{ loop.index + 3 }}. {{ i.1.d }} - -.. code-block:: yaml+jinja - :emphasize-lines: 1-3 - - mp: {{ i.1.mp }} - target: - {{ i.1.tt | to_yaml(indent=2) | indent(5) }} - result: "{{ lookup('file', target ~ '/templates/' ~ i.0.template) }}" - -{% endfor %} - -{% for i in tests[3:4]|subelements('group') %} -{{ loop.index + 5 }}. {{ i.1.d }} - -.. code-block:: yaml - :emphasize-lines: 1- - - input: - {{ i.0.input | to_yaml(indent=2) | indent(5) }} - -.. code-block:: yaml+jinja - :emphasize-lines: 1-4 - - mp: {{ i.1.mp }} - target: - {{ i.1.tt | to_yaml(indent=2) | indent(5) }} - result: "{{ lookup('file', target ~ '/templates/' ~ i.0.template) }}" - -gives - -.. code-block:: yaml - :emphasize-lines: 1- - - result: - {{ i.0.result | to_yaml(indent=2) | indent(5) }} - -{% endfor %} diff --git a/docs/docsite/helper/replace_keys/playbook.yml b/docs/docsite/helper/replace_keys/playbook.yml deleted file mode 100644 index 3619000144..0000000000 --- a/docs/docsite/helper/replace_keys/playbook.yml +++ /dev/null @@ -1,79 +0,0 @@ ---- -# 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 - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Create docs REST files -# shell> ansible-playbook playbook.yml -# -# Proofread and copy created *.rst file into the directory -# docs/docsite/rst. Do not add *.rst in this directory to the version -# control. -# -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# community.general/docs/docsite/helper/replace_keys/playbook.yml - -- name: Create RST file for docs/docsite/rst - hosts: localhost - gather_facts: false - - vars: - - plugin: replace_keys - plugin_type: filter - docs_path: - - filter_guide - - abstract_informations - - lists_of_dictionaries - - file_base: "{{ (docs_path + [plugin]) | join('-') }}" - file_rst: ../../rst/{{ file_base }}.rst - file_sha1: "{{ plugin }}.rst.sha1" - - target: "../../../../tests/integration/targets/{{ plugin_type }}_{{ plugin }}" - target_vars: "{{ target }}/vars/main/tests.yml" - target_sha1: tests.yml.sha1 - - tasks: - - - name: Test integrity tests.yml - when: - - integrity | d(true) | bool - - lookup('file', target_sha1) != lookup('pipe', 'sha1sum ' ~ target_vars) - block: - - - name: Changed tests.yml - ansible.builtin.debug: - msg: | - Changed {{ target_vars }} - Review the changes and update {{ target_sha1 }} - shell> sha1sum {{ target_vars }} > {{ target_sha1 }} - - - name: Changed tests.yml end host - ansible.builtin.meta: end_play - - - name: Test integrity RST file - when: - - integrity | d(true) | bool - - lookup('file', file_sha1) != lookup('pipe', 'sha1sum ' ~ file_rst) - block: - - - name: Changed RST file - ansible.builtin.debug: - msg: | - Changed {{ file_rst }} - Review the changes and update {{ file_sha1 }} - shell> sha1sum {{ file_rst }} > {{ file_sha1 }} - - - name: Changed RST file end host - ansible.builtin.meta: end_play - - - name: Include target vars - include_vars: - file: "{{ target_vars }}" - - - name: Create RST file - ansible.builtin.template: - src: "{{ file_base }}.rst.j2" - dest: "{{ file_base }}.rst" diff --git a/docs/docsite/helper/replace_keys/replace_keys.rst.sha1 b/docs/docsite/helper/replace_keys/replace_keys.rst.sha1 deleted file mode 100644 index 2ae692f3cc..0000000000 --- a/docs/docsite/helper/replace_keys/replace_keys.rst.sha1 +++ /dev/null @@ -1 +0,0 @@ -403f23c02ac02b1c3b611cb14f9b3ba59dc3f587 ../../rst/filter_guide-abstract_informations-lists_of_dictionaries-replace_keys.rst diff --git a/docs/docsite/helper/replace_keys/replace_keys.rst.sha1.license b/docs/docsite/helper/replace_keys/replace_keys.rst.sha1.license deleted file mode 100644 index a1390a69ed..0000000000 --- a/docs/docsite/helper/replace_keys/replace_keys.rst.sha1.license +++ /dev/null @@ -1,3 +0,0 @@ -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 diff --git a/docs/docsite/helper/replace_keys/tests.yml.sha1 b/docs/docsite/helper/replace_keys/tests.yml.sha1 deleted file mode 100644 index 53944ddf74..0000000000 --- a/docs/docsite/helper/replace_keys/tests.yml.sha1 +++ /dev/null @@ -1 +0,0 @@ -2e54f3528c95cca746d5748f1ed7ada56ad0890e ../../../../tests/integration/targets/filter_replace_keys/vars/main/tests.yml diff --git a/docs/docsite/helper/replace_keys/tests.yml.sha1.license b/docs/docsite/helper/replace_keys/tests.yml.sha1.license deleted file mode 100644 index a1390a69ed..0000000000 --- a/docs/docsite/helper/replace_keys/tests.yml.sha1.license +++ /dev/null @@ -1,3 +0,0 @@ -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