Question

Given the following example hiera config:

my_company::app1:
 - something

my_company::app2:
 - something else

database:
 - [db config ...]

Is there a way to iterate over all entries in namespace my_company? For example create a file for each app. The main constraint is that I need to process only the entries which belong to my_company. I guess the way to do this would be merging all such entries into one big hash, but is there a way to keep them in separate entries and do something like hiera('my_company::*:')?

Was it helpful?

Solution

As far as I know, not possible.

Rather easy to make it a hash though:

my_company:
  app1:
    - something
  app2:
    - something else

Then $data = hiera('mycompany') gives you all the data.

$app1 = $data['app1']
$app2 = $data['app2']

And so on.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top