Transfer value from master to minion (after reactor's triggered from minion)

56 Views Asked by At

Could you help me (tell the example) with my task: At the minion during highstate I want to execute a state (get some IP) at Saltstack's master. Then return this result to the minion and create a grain with this value. I've tried a lot of options, but I can't do it. I'll be very grateful for any help.

1

There are 1 best solutions below

0
On BEST ANSWER

One way to do this is:

  1. Write a state to be used against the master to get the data you require.
  2. Write a custom grain module that calls back to the master from the minion through the salt-api to apply the state to the master and then parse the result back and write the custom grain.

If the IP you are talking about though doesn't change often, then it probably should be served as a pillar instead of a grain.