Users should not have to re-specify entire variable blocks to change a few values. #21

Open
opened 2024-09-06 21:45:17 +00:00 by lanson · 0 comments
Owner

currently, in order to change default values, one must re-specify the entire block, which makes it prone to errors.

nomad_whatever:
  test: yes
  no_logs: yes

here, in order to change no_logs to false, the entire block must be redefined or the test key will be lost.

The goal is to have the final values be a merging of default + specific values potentially provided by the user (or not)

nomad_whatever: >-
  {{
    (hashistack_nomad_whatever| default({})) |
    combine(hashistack_default_nomad_whatever, recursive=true)
  }}

This way, by providing

hashistack_nomad_whatever:
  no_logs: no

and having the default

hashistack_default_nomad_whatever:
  test: yes
  no_logs: yes

the end result should be

nomad_whatever:
  test: yes
  no_logs: no
currently, in order to change default values, one must re-specify the entire block, which makes it prone to errors. ```yaml nomad_whatever: test: yes no_logs: yes ``` here, in order to change `no_logs` to false, the entire block must be redefined or the `test` key will be lost. The goal is to have the final values be a merging of default + specific values potentially provided by the user (or not) ``` nomad_whatever: >- {{ (hashistack_nomad_whatever| default({})) | combine(hashistack_default_nomad_whatever, recursive=true) }} ``` This way, by providing ```yaml hashistack_nomad_whatever: no_logs: no ``` and having the default ```yaml hashistack_default_nomad_whatever: test: yes no_logs: yes ``` the end result should be ```yaml nomad_whatever: test: yes no_logs: no ```
lanson added this to the Hashistack-Ansible project 2024-09-06 21:45:17 +00:00
lanson self-assigned this 2024-09-06 21:46:41 +00:00
lanson added the
enhancement
vault
nomad
consul
labels 2024-09-06 21:52:04 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ansible-collections/hashistack#21
No description provided.