From 08dd5686e3e7c094c667cddea0da915b10df6b15 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Wed, 21 Feb 2024 15:11:44 +0100 Subject: [PATCH] refactor(examples/ansible): rename folder to what the example is really about --- .../README.md | 4 +++- .../desired.toml | 0 .../initial.toml | 0 .../output.toml | 0 .../playbook.yml | 24 +++++++++---------- 5 files changed, 15 insertions(+), 13 deletions(-) rename examples/ansible/{gitlab.runner.customize-config => toml.customize}/README.md (85%) rename examples/ansible/{gitlab.runner.customize-config => toml.customize}/desired.toml (100%) rename examples/ansible/{gitlab.runner.customize-config => toml.customize}/initial.toml (100%) rename examples/ansible/{gitlab.runner.customize-config => toml.customize}/output.toml (100%) rename examples/ansible/{gitlab.runner.customize-config => toml.customize}/playbook.yml (81%) diff --git a/examples/ansible/gitlab.runner.customize-config/README.md b/examples/ansible/toml.customize/README.md similarity index 85% rename from examples/ansible/gitlab.runner.customize-config/README.md rename to examples/ansible/toml.customize/README.md index 2bac598..6a4ef9f 100644 --- a/examples/ansible/gitlab.runner.customize-config/README.md +++ b/examples/ansible/toml.customize/README.md @@ -1,4 +1,6 @@ -# Customize the given configuration of Gitlab runners +# Customize a given TOML file + +The example takes the configuration of a Gitlab runner as example just because it is a TOML file with known values. ## Requirements diff --git a/examples/ansible/gitlab.runner.customize-config/desired.toml b/examples/ansible/toml.customize/desired.toml similarity index 100% rename from examples/ansible/gitlab.runner.customize-config/desired.toml rename to examples/ansible/toml.customize/desired.toml diff --git a/examples/ansible/gitlab.runner.customize-config/initial.toml b/examples/ansible/toml.customize/initial.toml similarity index 100% rename from examples/ansible/gitlab.runner.customize-config/initial.toml rename to examples/ansible/toml.customize/initial.toml diff --git a/examples/ansible/gitlab.runner.customize-config/output.toml b/examples/ansible/toml.customize/output.toml similarity index 100% rename from examples/ansible/gitlab.runner.customize-config/output.toml rename to examples/ansible/toml.customize/output.toml diff --git a/examples/ansible/gitlab.runner.customize-config/playbook.yml b/examples/ansible/toml.customize/playbook.yml similarity index 81% rename from examples/ansible/gitlab.runner.customize-config/playbook.yml rename to examples/ansible/toml.customize/playbook.yml index a47e846..8986065 100644 --- a/examples/ansible/gitlab.runner.customize-config/playbook.yml +++ b/examples/ansible/toml.customize/playbook.yml @@ -1,13 +1,13 @@ --- -- name: Customize the given configuration of Gitlab runners +- name: Customize a given TOML file hosts: all vars: - config_base: > + toml_base: > {{ lookup('ansible.builtin.file', 'initial.toml') | sivel.toiletwater.from_toml }} - config_overrides: + toml_overrides: concurrent: 10 listen_address: '0.0.0.0:9090' runners: @@ -31,7 +31,7 @@ - 'amazonec2-private-address-only=true' MaxBuilds: 150 MaxGrowthRate: 2 - config_final: + toml_final: # There is no filter to automagically merge the objects in the 'runners' # list. This updates the base with the overrides at top level only, # (notice 'recursive=false'), then updates the result's list with a merged @@ -40,14 +40,14 @@ # the 'name' attribute for this. > {{ - config_base + toml_base | ansible.builtin.combine( - config_overrides, + toml_overrides, { "runners": ( - config_base.runners + toml_base.runners | community.general.lists_mergeby( - config_overrides.runners, + toml_overrides.runners, 'name' ) ) @@ -60,7 +60,7 @@ ansible.builtin.debug: var: item with_items: - - "{{ config_base }}" - - "{{ config_overrides }}" - - "{{ config_final }}" - - "{{ config_final | sivel.toiletwater.to_toml }}" + - "{{ toml_base }}" + - "{{ toml_overrides }}" + - "{{ toml_final }}" + - "{{ toml_final | sivel.toiletwater.to_toml }}"