'How to call a current inventory name in the if condition in saltstate?
I have a simple saltstate. My question is using jinja or whatever else, how can I specify it or steps of it to run only if inventory name contains some string?
Where I can check all the saltstack variables documentation btw?
Solution 1:[1]
I think you want to target minions by grains. Salt have many grains set by default, but you can add your own grain. After adding you own "inventory" grain, you can target the minion in the top file.
Check all grains of a minion: salt "minion" grains.items
Set your own grain: salt "minion" grains.set inventory inventory_num
Target minion by new grain: salt -G "inventory:inventory_num" test.ping
Further information:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | SynPrime |
