Replies: 1 comment
-
you have to use api call to retrieve these informations, either by API curl or shell spacecmd. With Salt you could use the runner function to interact from minion to master but the suma api is protected by authentification so you have to integrate this step and to evaluate that activate the runner module on master is considered as a risk. For that kind of tasks i have python script, credentials are protected by pillar interpolations in the jinja template (variables and context) and the scripts are located in the /srv/salt tree (which is managed by our gitlab pipeline. Then a simple sls with file.managed and cmd.script could be affected on any minion that could reach suma on https. You have to parse the output according to your needs If you could pass real time, you could create a cronjob with a api script and a function which generate the target host file locally to the suma/salt master, spacecmd will be your friend and redirect the output directly in /srv/salt/ tree. the cron could be run eg. every 24h, then a sls file.managed directly on your systems for the host file. Manage host file with multiple entries even by IaC is deprecated maybe could you think to fill your needs with another approach. regards |
Beta Was this translation helpful? Give feedback.
-
Hi all,
with salt i would like to create /etc/hosts with entries for all members of a system group.
so if sys1, sys2, sys3 and sys4 are all member of group "bla", i would like salt to return those names for me, so i can query their ips and put everything into /etc/hosts.
What is a good way to do this? I tried salt runner spacewalk.api but were unable to call it within my state file.
BR
Heiner
Beta Was this translation helpful? Give feedback.
All reactions