hdm icon indicating copy to clipboard operation
hdm copied to clipboard

allow usage of hiera lookup_options

Open tuxmea opened this issue 4 years ago • 0 comments

Within a hiera hierarchy, one has the option to set the merge behavior using the key "lookup_options".

Example: data/common.yaml

lookup_options:
  <key>:
    merge: <merge behavior>
  convert_to: <Data Type> # Usually "Sensitive"

The following merge behavior options are possible:

  • first - the default hiera behavior
  • unique - used on arrays
  • hash - merges all hash keys (on first level)
  • deep - similar to hash, but merges subkeys, too

The hiera key lookup_options should always be the very first in the list of keys (if set).

HDM should show the lookup_options providing a text message above the top hierarchy.

lookup option: merge: first, convert_to: <Data Type>

Note: lookup options can be set in every hiera hierarchy. Updated test code is in mulitple_environmenrs. Node sse8epsu.example42.training has lookup option for profile::auth::sshd_config_allowgroups set to 'first' and in common it is set to 'unique'.

Hiera uses deep merge on lookup_options.

e.g.

  1. Node specific:
lookup_options:
    <key1>:
     merge: deep
  <key2>:
    merge: first
    convert_to: 'Sensitive'
  1. common:
lookup_options:
    <key1>:
     merge: first

tuxmea avatar May 01 '21 12:05 tuxmea