Hi, I've got a problem with Hiera interpolation (lookups). I'm fairly new to Hiera, so I think I am misunderstanding something important, but doc searches revealed nothing so far.
I'm using Puppet 7.x with the following hiera.yaml:
# hiera.yaml
---
version: 5
hierarchy:
- name: "Per-node data"
path: "nodes/%{::trusted.certname}.yaml"
- name: "Per-subsystem data" path: "subsystems/%{::subsystem}.yaml"
- name: "Common and fallback data" path: "common.yaml"
Basically, data should be searched first in the node-specific file, then in a subsystem specific file, then in the common file (that is empty, so far).
(bare bones) Agent-specific file looks like this:
# environments/test/data/nodes/agent1.yaml
---
my:
net:
host:
ip_address: "%{lookup('my.net.hosts.agent1')}"
needs_proxy: false
(you see that I use lookup interpolation, that's in order to avoid data duplication).
The my.net.hosts.agent1 key is not part of this file, but is found in the subsystem-specific
yaml:
# environments/test/data/subsystems/main.yaml
---
my:
net: hosts:
agent01: "192.168.56.6"
needs_proxy: true
Per the hiera.yaml above it this comes later in the hierarchy.
Unfortunately, the agent fails with the following error:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Lookup of key 'my.net.hosts.agent01' failed: Recursive lookup detected in [my.net.needs_proxy, my.net.hosts.agent01] on node agent1
and I got no clue why that happens, as I can't see any obvious loops.
Any help would be greatly appreciated.
Thanks
Michele