Hi Megan,
My apologies for the delay of my answer.
Thank you for this answer.
Yes, this is related, with the small difference that I need this information in both Pillars and Salt States. Difficulty is that when you import files, in states it has to be distributed by the salt file server, so in /srv/salt for states in default configuration, and same for pillars in /srv/pillar. And relative path are not allowed in jinja import.
I found a workaround using the following :
in /srv, I add a file called network.sls
In this file, you can find this kind of structure :
network:
repo:
name: repo0
ip: 172.16.0.13
dhcp:
name: dhcp0
ip: 172.16.0.12
Then, in /srv/salt, I do a :
ln -s ../network.sls network.sls
And the same in /srv/pillar :
ln -s ../network.sls network.sls
Doing it this way allow me to migrate my /srv directory into another location if needed.
Then, in my /srv/pillar/top.sls, I use :
{% import_yaml 'network.sls' as vars %}
base:
'{{vars.network.dhcp.ip}}':
- repostuff
- dhcpstuff
And in my /srv/salt/top.sks :
{% import_yaml 'network.sls' as vars %}
base:
'{{vars.network.dhcp.ip}}':
- repo.client
- dhcp.server
And it works !! In fact, I only need to specify main network things inside this network file, which is shared.
Off course, it is a workaround, not a "clean" solution, but it is enough here as only few information need to be shared between top pillars and top states.
Salt is so flexible I want to use it at maximum to avoid redundant information.
Benoît