Pillar
Pillar and grains are not the same, they are defined on the server and are some information that is defined for minion. Like some of the more important data (passwords) can exist in pillar, you can also define variables and so on.
View the pillar value for the specified minion (the version I tested is empty):
Salt ' client.wyp.com ' pillar.items
Configure custom pillar on server
Vim/etc/salt/mster
Locate the following configuration:
Pillar_roots:
Base: #空两个空格
-/srv/pillar #继续空两个空格, YAML format. Fixed notation
Remove the previous # number
Mkdir/srv/pillar
VI/SRV/PILLAR/TEST.SLS//content as follows, customize some pillar information, the module name cannot start with a number.
Conf:/etc/123.conf
VI/SRV/PILLAR/TOP.SLS//content is as follows, the total Portal configuration file, otherwise the above configuration does not take effect.
Base
' Client.wyp.com ': #客户端列表
-Test #加载test
Restart Master
/etc/init.d/salt-master restart
After the pillar configuration file is changed, we can get the new pillar state by refreshing the pillar configuration: no reboot required
Salt ' * ' saltutil.refresh_pillar
Verify:
Salt ' * ' Pillar.items
Salt ' * ' Pillar.item test
Pillar can also be used as a matching object for salt. Like what
Salt-i ' conf:/etc/123.conf ' test.ping
2.4-saltstack Pillar