Reputation: 31
I have a state where at the end I make an API call. I need to use the minion id as a parameter in that call but I'm not sure how to get it. Is there a default variable to use so I can include the id in the call?
Upvotes: 2
Views: 1032
Reputation: 704
So, there are a couple of variables that can be called.
{{grains["id"]}}
{{salt["grains.get"]("id")}}
{{opts["id"]}}
{{salt["config.get"]("id")}}
This is 4 ways to get the same value 2 from grains. 1 from opts. and 1 from config.get. the id of the minion rendering the state.
here it is being rendered on my salt-master through a salt-call.
[root@salt00 tests]# salt-call slsutil.renderer salt://tests/test4.sls default_renderer=jinja
local:
salt00.wolfnet.bad4.us
salt00.wolfnet.bad4.us
salt00.wolfnet.bad4.us
salt00.wolfnet.bad4.us
Upvotes: 3