Salt stack grains
Grains is an interface that provides information specific to a minion. The information available through the grains interface is static. Grains get loaded when the Salt minion starts. This means that the information in grains is unchanging. So grains information could be about the running kernel or the operating system.
Types of grains
There are two types of grains (these come with the Salt installation) and custom grains. The latter are found in
*/etc/salt/grains
*/etc/salt/minion
*Grains directory, synced to minions
Grains Targeting
Grain data can be used when targeting minions, which is defined in the following code block.
#salt -G 'os:Ubuntu' test.ping
ubuntu-01:
True
Listing Grains
Grains can be listed by using the ‘grains.ls’ module,
# salt '*' grains.ls
ubuntu-01:
- SSDs
- biosreleasedate
- biosversion
List Items
Grains data can also be listed by using the 'grains.items’.
# salt '*' grains.items
ubuntu-01:
----------
SSDs:
biosreleasedate:
12/01/2006
Recent Comments
No comments
Leave a Comment
We will be happy to hear what you think about this post